So I'm looking to write a script file which takes in a user-inputed number, and based off that number, it will execute a certain command. This command is the
awk command that, of course, uses a field separator. I'm using
awk on the following file
smiths|Login|2 olivert|Login|2 northj|Login|2 denniss|Login|2 smithd|Login|2 smiths|Time Reporting|210 olivert|Payroll|155 northj|Server Maintenance|70 northj|Logfile Reporting|45 denniss|Report Printing|80 smithd|Payroll Program Updates|150 smithd|Payroll Program Updates|180 smiths|Logout|2 olivert|Logout|2 northj|Logout|2 denniss|Logout|2 smithd|Logout|2
My issue is that I'm trying to use the pipe as the field separator, but when I try backslash-escaping the pipe (which is what I think I'm supposed to do), it's not actually quoting it. If I use something like a colon, it's fine:
case "$choice" in 1) awk -F : '$2\n' ;; 2) awk -F : '$1\n' ;;
Instead of the colon, I'm looking to use the pipe (refer to the file above) as the field separator. Any answers are appreciated!