Jun 29, 2005 #1 ecmanfr Technical User May 14, 2005 9 FR Hello, In a file I would like delete the last 2 lines, and the other file I would like delete the 2 first lines and concat the 2 files Thank You.
Hello, In a file I would like delete the last 2 lines, and the other file I would like delete the 2 first lines and concat the 2 files Thank You.
Jun 29, 2005 #2 PHV MIS Nov 8, 2002 53,708 FR In an unix shell: (sed '$d' /path/to/input1 | sed '$d'; sed '1,2$' /path/to/input2) >/path/to/output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
In an unix shell: (sed '$d' /path/to/input1 | sed '$d'; sed '1,2$' /path/to/input2) >/path/to/output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Jun 29, 2005 Thread starter #3 ecmanfr Technical User May 14, 2005 9 FR Sorry, I work with awk95 under win32 I don't know the sed command Upvote 0 Downvote
Jun 29, 2005 #4 vgersh99 Programmer Jul 27, 2000 2,146 US (sed 'N;$!P;$!D;$d' /path/to/input1; sed '1,2d' /path/to/input2) > >/path/to/output sed1liners vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
(sed 'N;$!P;$!D;$d' /path/to/input1; sed '1,2d' /path/to/input2) > >/path/to/output sed1liners vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Jun 29, 2005 #5 PHV MIS Nov 8, 2002 53,708 FR ecmanfr.awk: NR==FNR{a[++i]=$0;next} FNR==3{for(j=1;j<i-1;++j)print a[j]} {print} awk95 -f ecmanfr.awk file1 file2 > output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
ecmanfr.awk: NR==FNR{a[++i]=$0;next} FNR==3{for(j=1;j<i-1;++j)print a[j]} {print} awk95 -f ecmanfr.awk file1 file2 > output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886