0

I have an awk command on ksh script, the command extract fields from a log file to then struct them in new one.

ultimate=$(grep -oP 'Time:\K.*' $log2 | column -t | awk '{print $3,"/","'"$month"'","/",$2,";",$4,";","'"$fBrand"'",";",'"$fUser"'",";","'"$fSerial"'",";","'"$fEmail"'",";","'"$fLocation"'",";"}' | sort | sed 's: ::g')

when I execute the script, it returns to me:

awk: cmd. line:934: 22",";","[email protected]",";","fn,",";"
awk: cmd. line:934:               ^ invalid char '@' in expression
Mauricio Reyes
  • 349
  • 2
  • 4
  • 18
  • Mother of quotes...Not really a duplicate but this should help: https://unix.stackexchange.com/q/120788/237982 – jesse_b Aug 16 '18 at 16:32
  • haha I'll find another way to improve the order. Thanks – Mauricio Reyes Aug 16 '18 at 16:36
  • 1
    This answer covers some better alternatives to passing variables into awk: [Environment variable not expanded inside the command line argument](https://unix.stackexchange.com/a/162699/65304) – steeldriver Aug 16 '18 at 18:08

0 Answers0