|
|||||||
| 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
|
|||
|
|||
|
Is there a way to append both at header and footer of a file
currently I've a file Code:
Insert into CD_CARD_TYPE
(CODE, DESCRIPTION, LAST_UPDATE_BY, LAST_UPDATE_DATE)
Values
('024', '024', 2, sysdate);
Insert into CD_CARD_TYPE
(CODE, DESCRIPTION, LAST_UPDATE_BY, LAST_UPDATE_DATE)
Values
('032', '032', 2, sysdate);
........is it possible to add the following such that output will become as follow: Code:
prompt loading CD_CARD_TYPE
Insert into CD_CARD_TYPE
(CODE, DESCRIPTION, LAST_UPDATE_BY, LAST_UPDATE_DATE)
Values
('024', '024', 2, sysdate);
Insert into CD_CARD_TYPE
(CODE, DESCRIPTION, LAST_UPDATE_BY, LAST_UPDATE_DATE)
Values
('032', '032', 2, sysdate);
........
prompt done loadingunderstand that we can append anything to the footer of a file by doing the following echo "prompt done loading" > filename.txt but how about appending the header? thanks a lot! |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Try this for header. Code:
sed '1i\ your text' file_name |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
Put header in a headerfile and then cat headerfile filename.txt |
|
#4
|
|||
|
|||
|
Try this Code:
sed '1i\ header $a\ footer' filename |
| Sponsored Links | ||
|
![]() |
| Tags |
| append header shell bash ksh |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Removing header or footer from file | sridhardwh | Shell Programming and Scripting | 5 | 06-04-2012 05:43 AM |
| Add header and footer with record count in footer | itsranjan | Shell Programming and Scripting | 1 | 03-24-2012 11:45 PM |
| sort a report file having header and footer | suryanarayana | Shell Programming and Scripting | 4 | 11-25-2011 09:48 PM |
| Append Spaces At end of each line Leaving Header and Footer | deepam | Shell Programming and Scripting | 1 | 10-21-2008 04:08 AM |
| Total of lines w/out header and footer incude for a file | gzs553 | Shell Programming and Scripting | 1 | 11-16-2006 06:42 PM |
|
|