When processing windows format text, use \r\n as the newline character, if the data involved in the operation is at the end of the line
syntax error: invalid arithmetic operator (error token is “
https://stackoverflow.com/questions/43309793/remove-rn-in-awk
awk -v RS= ' \r\n ' ...
awk ' { sub("\r$", ""); ...}
awk ' {sub(/\r/,"",$NF); ...} '
awk ' BEGIN { RS=ORS="\r\n"; ...
foo=$ ' 5\r ' ; echo $(( 5 + foo)) " )syntax error: invalid arithmetic operator (error token is "
foo=$ ' 5\r ' ; echo $(( 5 +${foo // $'\r'}))
foo=$ ' 5\r ' ; echo $(( 5 +$( tr -d ' \r ' <<< " $foo " )))
or remove \r
foo=$ ' 5\r ' ; foo=${foo // $'\r'}
Similar Posts:
- [Solved] SyntaxError: unexpected character after line continuation character
- One line command / usr / bin / Perl ^ m: bad interpreter
- [Solved] Expected linebreaks to be ‘LF’ but found ‘CRLF’.
- [Solved] Shell Script [: -ge/-le/=/… : unary operator expected (standard_in) 1: syntax error
- Script error: unary operator expected [How to Solve]
- Git clone fatal: protocol ‘https’ is not supported
- PIP install nltk Error: SyntaxError: invalid syntax (from nltk.tokenize import RegexpTokenizer)
- shell :syntax error: unexpected end of file
- Shell script error newline syntax error near unexpected token
- How to read and write multiple files in Python?