Computing.Net > Forums > Unix > putting strings on a file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

putting strings on a file

Reply to Message Icon

Name: Irene
Date: August 20, 2003 at 03:05:59 Pacific
OS: Win 2000
CPU/Ram: P4/256 MB
Comment:

Hi all,
I think this is very easy for you :)...

I should write on file1 lines like:

var:resultoftail


but I cannot put everything on the same line by using this command in the script:

echo $var":" >> file1|tail -1 file2 >> file1


Nor if I use \\n.
How can I do to 'build' every single line ?!

I'd appreciate very much any help!
Cheers,
Irene



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: August 20, 2003 at 04:55:12 Pacific
Reply:

sed -e 's/\(.*\)/var:\1/' file1

Also the man pages for echo show that the \c can be used with echo to suppress a new line if you want to do something like this:

echo -e "I have \c"
echo -e "a red \c"
echo -e "pencil box."


0
Reply to Message Icon

Related Posts

See More


Using rm command Help scripting arguments



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: putting strings on a file

Adding a new string in a file www.computing.net/answers/unix/adding-a-new-string-in-a-file/8060.html

replacing a string in a file www.computing.net/answers/unix/replacing-a-string-in-a-file/6138.html

sed on a file www.computing.net/answers/unix/sed-on-a-file/4866.html