|
-
Jun 27th, 2007, 06:28 AM
#1
Thread Starter
Member
[RESOLVED] Bash SED command - Adding text to end of file
Hey,
I'm using the Unix SED command to try and add text to the end of a file.
Here is my current example:
Code:
#!/bin/bash
sed "s/./username/" users.txt
This adds 'username' to the beginning of every line in the users.txt file.
Example:
username john1
username mary2
username hiller3
How can I make it so that it adds this just once at the very bottom of the file?
Desired output:
john1
mary2
hiller3
username
Cheers for your help!!
Last edited by DonCash; Jun 27th, 2007 at 07:12 AM.
-
Jun 27th, 2007, 07:00 AM
#2
Re: Bash SED command - Adding text to end of file
Don't use sed for this. If you want to add a single line to the end of the file, then use cat or echo to append to the file.
Code:
$ echo "username" >> users.txt
-
Jun 27th, 2007, 07:11 AM
#3
Thread Starter
Member
Re: Bash SED command - Adding text to end of file
Your the man!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|