| Author |
Read .txt file n append lines using shell script
|
Sham Jowsaki
Ranch Hand
Joined: May 22, 2001
Posts: 146
|
|
Hi All, There is a multiple directories which had bunch of files (.txt), where I would like to read the (.txt) file n append some lines on each file using shell script. Could you pls guide me how to do this n provide the sample script. Thanks in advance. Cheers Jowsaki
|
 |
Pranav Butala
Greenhorn
Joined: Jan 20, 2004
Posts: 27
|
|
What platform r u working on? Tried using VBScript to append to a .txt file? I have a VBScript that reads a .txt file in to an array to perform some calculations. I can modify it append to a .txt file. Let me know if you need it.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24059
|
|
Originally posted by Pranav Butala: What platform r u working on? Tried using VBScript to append to a .txt file?
As this is the Linux/UNIX forum, the poster is lucky enough not to have VBScript available. Sham: This puts a line of text into a file, destroying any previous contents: echo "Here is a line of text" > afile.txt This, on the other hand, appends to an existing file: echo "Here is another line of text" >> afile.txt
|
[Jess in Action][AskingGoodQuestions]
|
 |
Tim West
Ranch Hand
Joined: Mar 15, 2004
Posts: 539
|
|
You might want something like this... Anyway, that's a start...it's basic stuff but bash scripting took me a while to get the hang of (mostly because I learned programming on languages with passably decent syntax..."for i in `seq 1 10`" is barbaric eh?...ok maybe that's just an excuse ), so it might save you some time... Cheers, --Tim [ April 13, 2004: Message edited by: Tim West ]
|
 |
 |
|
|
subject: Read .txt file n append lines using shell script
|
|
|