prgeorge3383
asked on
awk in windows
This works fine in linux /unix
cat file.txt | awk -F ";" '{ printf(",%s,%s,%s,%s,\n", substr($21,0,10),$99,$105, $104)}' > lrep_1.txt
i am trying to run this in windows like this
cat file.txt | g awk -F ";" '{ printf(",%s,%s,%s,%s,\n", substr($21,0,10),$99,$105, $104)}' > lrep_1.txt
Attached is the error
C:\iscripts>cat file.txt | gawk -F ";" '{ printf(",%s,
%s,%s,%s,\n", substr($21,0,10),$99,$105, $104)}' > lrep_1.txt
gawk: cmd. line:1: '{
gawk: cmd. line:1: ^ Invalid char ''' in expression
Thanks for the help in advance
cat file.txt | awk -F ";" '{ printf(",%s,%s,%s,%s,\n", substr($21,0,10),$99,$105,
i am trying to run this in windows like this
cat file.txt | g awk -F ";" '{ printf(",%s,%s,%s,%s,\n", substr($21,0,10),$99,$105,
Attached is the error
C:\iscripts>cat file.txt | gawk -F ";" '{ printf(",%s,
%s,%s,%s,\n", substr($21,0,10),$99,$105,
gawk: cmd. line:1: '{
gawk: cmd. line:1: ^ Invalid char ''' in expression
Thanks for the help in advance
in windows you usually need to quote a command argument with "" instead of ''
ASKER
tried this .... does not work
cat file.txt | gawk -F "";"" ""{ printf(",%s,%s,%s,%s,\n", substr($21,0,10),$99,$105, $104)}""
cat file.txt | gawk -F ";" ""{ printf(",%s,%s,%s,%s,\n", substr($21,0,10),$99,$105, $104)}""
thanks
cat file.txt | gawk -F "";"" ""{ printf(",%s,%s,%s,%s,\n", substr($21,0,10),$99,$105,
cat file.txt | gawk -F ";" ""{ printf(",%s,%s,%s,%s,\n", substr($21,0,10),$99,$105,
thanks
ozo meant that you use
cat file.txt | gawk -F ";" "{ printf(',%s,%s,%s,%s,\n', substr($21,0,10),$99,$105, $104)}"
but I guess that you then struggle with ' inside the awk script
in such unreliable systems (Windoze, cmd.exe, whatever) you better use a file for you awk commands
cat file.txt | gawk -F ";" "{ printf(',%s,%s,%s,%s,\n', substr($21,0,10),$99,$105,
but I guess that you then struggle with ' inside the awk script
in such unreliable systems (Windoze, cmd.exe, whatever) you better use a file for you awk commands
try
cat file.txt | gawk -F ";" "{ printf("",%s,%s,%s,%s,\n"" , substr($21,0,10),$99,$105, $104)}"
cat file.txt | gawk -F ";" "{ printf("",%s,%s,%s,%s,\n""
ASKER
will try the file... that is probably the best way
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.