linux - awk save command ouput to variable -
I need to execute a few lines of file for example I for example:
File1.txt 100 4 file2.txt198
So my awk
script needs to execute something like this
< Save code> command $ 1 $ 2 $ 3
and command $ 1 $ 2 $ 3
, so system
work Will not and will not be getline
. (If I do something like this then I can not pipeline production.)
The ban of this problem is only to use awk
(I already have Beschcreat + Azik There was a solution with ... but I just want to awk ... just to know more about this)
What is wrong with using
getline
$ ./test.awk test.txt # ls -F | Grep test test.awk * test.txt # cat test.txt | NL 1 LS-F. Grep test 2 cat test.txt | NL3 cat test.awk # cat test.awk #! / Usr / bin / awk -f {cmd [nr] = $ 0 While ($ 0 | Grinline line) Output [NR] = Output [NR] Line RS} End {to (in CMD) Print "#" CMD [ I] ORS output [i]}
Comments
Post a Comment