Skip to main content
8 events
when toggle format what by license comment
Mar 15, 2021 at 12:43 comment added Ed Morton Again, without seeing what you're trying to execute, I can't do much to help you debug it. Whatever it is you have in that file, it's not the script I show in my answer. Oh, hang on - did you put $ cat tst.awk at the top of the file? Don't do that - $ is my prompt and cat tst.awk is the shell command I ran to show you the contents of the file tst.awk. The awk script that should be in tst.awk starts with the line BEGIN { FS=OFS="\t" }.
Mar 15, 2021 at 8:33 comment added Tommaso Palomba Sorry I copied the script to a file .sh. Now I did as you say, but it gives me this error: awk: tst.awk:1: $ cat tst.awk awk: tst.awk:1: ^ syntax error
Mar 13, 2021 at 17:15 comment added Ed Morton You'd have to tell me what script.sh contained if you'd like me to help debug it but my best guess is you saved the awk script in a file named script.sh and then tried to execute it as if it was a shell script instead of passing it to awk to interpret. Just run the command exactly as shown in my answer - store the awk script in a file named tst.awk and run it as awk -f tst.awk file1.txt list.txt matrix.txt.
Mar 13, 2021 at 15:27 comment added Tommaso Palomba The scrip give me this error: script.sh: line 1: '$: command not found script.sh: line 2: BEGIN: command not found script.sh: line 3: FILENAME: command not found script.sh: line 4: rowNames[]: command not found script.sh: line 5: next: command not found script.sh: line 6: syntax error near unexpected token }' script.sh: line 6: }''
Mar 13, 2021 at 14:46 history edited Ed Morton CC BY-SA 4.0
deleted 901 characters in body
Mar 13, 2021 at 14:15 history edited Ed Morton CC BY-SA 4.0
added 582 characters in body
Mar 13, 2021 at 14:10 history edited Ed Morton CC BY-SA 4.0
added 582 characters in body
Mar 13, 2021 at 14:00 history answered Ed Morton CC BY-SA 4.0