- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- help--with sed
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-23-2008 05:17 AM
тАО01-23-2008 05:17 AM
help--with sed
I have a file called fields.txt and i have the following in it as contents
`cat /ghl`
echo "debug"
echo "complete"
My question is how do i insert some text in the first line before `cat /ghl` using sed.
And how do i insert after last word in the last line using sed.Please help me guys its urgent...
Please give the code..thanks in advance..
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-23-2008 05:30 AM
тАО01-23-2008 05:30 AM
Re: help--with sed
sed "1 s/^/word_to_insert /" filename
You will add "word_to_insert " to the begining of the first line in "filename".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-23-2008 05:46 AM
тАО01-23-2008 05:46 AM
Re: help--with sed
Please keep asigning points. For help about this, see:
http://forums1.itrc.hp.com/service/forums/helptips.do?#28
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-23-2008 10:59 AM
тАО01-23-2008 10:59 AM
Re: help--with sed
# sed -e '1 s/^/_BEGIN_/' -e '$ s/$/_END_/' fields.txt
...using your example, this would yield:
_BEGIN_`cat /ghl`
echo "debug"
echo "complete"_END_
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-23-2008 11:25 PM
тАО01-23-2008 11:25 PM
Re: help--with sed
to insert some text first line before. use this command line
sed "1 s/^/word_to_insert /" filename
to insert some text lost line before. use this command line
sed "(lost line number) s/$/word_to_insert /" filename