Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


LinkBack Search this Thread
Old 05-25-2006, 04:36 AM   #1
Registered: Nov 2004
Location: india
Distribution: Fedora core 1
Posts: 67

Rep: Reputation: 15
shell script for expanding lines in a file

need shell script that will convert existing file's contents from


cp /misc/file1 /opt/my/files/misc/file1
cp /misc/file/file2 /opt/my/files/misc/file/file2
cp /misc/file3/file4/file5 /iopt/my/files/misc/file3/file4/file5
Old 05-25-2006, 04:51 AM   #2
Registered: May 2006
Location: India
Distribution: Redhat
Posts: 49

Rep: Reputation: 15
Hi b123coder,
My script uses the filename as "test". You can give your file name and test it...

word="cp ";
cat $filename|while read line
echo "$word$line $append$line" >> tempfile;
cat tempfile > $filename;
rm -f tempfile;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
expanding variable in shell script dipenchaudhary Programming 8 02-08-2006 05:05 PM
How can I use a shell script to add and replace lines in a file? abefroman Programming 10 12-27-2005 05:05 PM
Shell Script (adding a prefix to output lines) rheza Programming 3 01-04-2005 01:18 PM
[c shell] How do I find how many lines a file has? saiz66 Programming 5 10-08-2004 03:01 PM
shell script to copy lines from a file Warmduvet Programming 2 09-14-2004 09:25 PM

All times are GMT -5. The time now is 07:18 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration