|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi I need to merge 4 files. The issue i am facing is all the files have headers and i do not want them in the final output file. Can anybody suggest how to do it?
|
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
try Code:
for FILE in *
do
exec 5<"$FILE"
read LINE <&5
[ -z "$FIRST" ] && echo "$LINE"
FIRST="no"
cat <&5
exec 5<&-
done > merged.file |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
can i have a awk one liner for this?
|
|
#4
|
|||
|
|||
|
try: Code:
awk 'FNR>1' file1 file2 file3 file4 > new_file |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Code:
awk -v var=`wc -l < files ` 'NR>1 && /Header row/ {next}{print}' files |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Thanks very much for the answers . sorry for late response i just came back from office.
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Editing File Headers | andysuperaudiom | Shell Programming and Scripting | 3 | 08-01-2011 10:00 AM |
| Multiple headers in a file | gaur.deepti | Shell Programming and Scripting | 7 | 04-14-2011 09:29 AM |
| Merging of files with different headers to make combined headers file | marut_ashu | Shell Programming and Scripting | 1 | 08-07-2009 04:10 AM |
| reading file headers | Allasso | UNIX for Dummies Questions & Answers | 2 | 04-27-2009 03:10 PM |
| Remove text between headers while leaving headers intact | Trones | Shell Programming and Scripting | 3 | 12-27-2008 07:06 PM |
|
|