Tag Info

New answers tagged


To match the contents of ARGV[i] you need to change your test to if ($2 ~ ARGV[i]) Otherwise, you are testing for a match to the literal regex 'ARGV[i]' which is not what you want. Then your script will (kind of) work if you run it like this: awk -f qtest.awk testing.txt "Jesse Pinkman" "Walter White" But then it will throw an error when it finishes ...


You're overthinking it. All you need is this: cat > texttest.txt Cat will read from STDIN if you've not told it different. Since it's reading from STDIN, it will react to the control character Ctrl+D without your having to specify it. And since Ctrl+D is the only thing that will finish the cat subprocess, you don't even need to wrap it in a loop.


The following would do: while read -r LINE ; do echo "$LINE" >> texttest.txt done you don't need to touch the file first you don't need to initialize the LINE variable Ctrl+D closes stdin, which makes read exit with non-null (false) exit code

Top 50 recent answers are included