07592161981m
asked on
Bash Shell Script to merge two files
Hi Experts,
I have two log files logfile A and logfile B . I am looking for a script to delete the starting 10 lines from logfileB and attaching it to bottom of logfile A.
I have two log files logfile A and logfile B . I am looking for a script to delete the starting 10 lines from logfileB and attaching it to bottom of logfile A.
Hi 07592161981m,
Judging by your topic areas, it looks as if you want a Linux shell script.
head logfileB >>logfileA
sed -i '1,10d' logfileB
You may run into problems if the files are being written to at the time the above commands are run, though.
Judging by your topic areas, it looks as if you want a Linux shell script.
head logfileB >>logfileA
sed -i '1,10d' logfileB
You may run into problems if the files are being written to at the time the above commands are run, though.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Good thinking, simon!
For some strange reason, i thought 07592161981m wanted to:
"delete the starting 10 lines from logfileB"
so they are removed from it,
"and attached it" (i.e. those 10 lines) "to bottom of logfile A".
I hope the spec's are less ambiguous next time, so experts don't waste time going down the wrong track.
tel2
For some strange reason, i thought 07592161981m wanted to:
"delete the starting 10 lines from logfileB"
so they are removed from it,
"and attached it" (i.e. those 10 lines) "to bottom of logfile A".
I hope the spec's are less ambiguous next time, so experts don't waste time going down the wrong track.
tel2
FOR /F "usebackq skip=10 tokens=*" %%A in ("C:\path\file B.txt") DO ECHO %%A>>"C:\path\file A.txt"
In a simple DOS command line, change %% by %
I hope that helps.
Cheers,
Rene