I have two files want to copy the last column of the last line of them to two different files in different lines and columns.
let say if the last number of the first two files are 1 and 3 I want to have a new file which contains
1
3
and an other file
1 3
In awk save the last field and at the END, print out the last field a newfile. Then, use xargs to print the output of the newfile eliminating the carriage returns: #!/bin/ksh rm -f newfile otherfile for ind in file1 file3 do awk ' { savefield=$NF } END { # print last lines last field printf("%s\n", savefield) } ' $ind >> newfile done # create the otherfile xargs < newfile > otherfile
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |