|
|||||||
| 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
|
|||
|
|||
|
Add text to beginning of file
Hi
I need to add text to the beginning of a file in the same way that cat will put file contents at the end of a file. I want to do this with many files eg cat newtext >> /usr/home/*/*.bat Any ideas? |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Something like this Code:
$ ls /usr/home/*/*.bat | while read file; do
> ( echo "add this"; cat ${file} ) > ${file}.new && mv ${file}.new ${file}
> doneCheers, ZB |
| 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 |
| Count Number Of lines in text files and append values to beginning of file | motoxeryz125 | UNIX for Dummies Questions & Answers | 7 | 04-28-2011 02:36 AM |
| bash: prepend same text to beginning of all lines of file | SilversleevesX | Shell Programming and Scripting | 1 | 09-18-2010 05:55 PM |
| Appending at the beginning of the file. | siba.s.nayak | UNIX for Dummies Questions & Answers | 1 | 04-14-2010 07:16 AM |
| Append (cat) to beginning of file ? | CBZ | Shell Programming and Scripting | 8 | 02-19-2008 12:26 AM |
| cat a file from end to beginning | jpprial | UNIX for Dummies Questions & Answers | 5 | 03-31-2001 07:14 AM |
|
|