Linux-Change line between two awk scripts -


i have 2 awk scripts run in linux. output of each 1 in 1 line. how can separate 2 output 2 lines?

for example:

awk '{printf $1}' f.txt >> a.txt awk '{printf $3}' f.txt >> a.txt 

the output of first script is:

35 56 40 28 57 

and second output is:

29 48 73 26 

if run them 1 after another, output become:

35 56 40 28 57 29 48 73 26 

is there way result to:

35 56 40 28 57 29 48 73 26 

thank you!~

although don't understand how manage spaces between fields way it, can add end statement first script:

awk '{printf $1} end{print "\n"}' 

you can single awk command:

awk -v ors=" " 'begin{argv[argc++] = argv[1]; = 1 }                  nr!=fnr && fnr==1 { printf "\n"; i=3 }                  { print $i }                  end { printf "\n" }' f.txt 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -