- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Awk expert's help needed (how to edit a text f...
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
тАО06-09-2005 01:13 AM
тАО06-09-2005 01:13 AM
I have a text file and I'd like to use awk to edit it. I'd like it to go to the line 18 and from there add the phrase "/work/" to the beginning of each line.
AWK/GAWK experts, I request your help and appreciate your response.
Hanif Kazemi.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2005 01:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2005 01:36 AM
тАО06-09-2005 01:36 AM
Re: Awk expert's help needed (how to edit a text file?)
ex file <
s_^_\/work\/_
:wq
EOS
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2005 01:41 AM
тАО06-09-2005 01:41 AM
Re: Awk expert's help needed (how to edit a text file?)
ex file <
s_^_\/work\/_g999999
:wq
EOS
I would imagine awk to be thousands of times slower than ex for such a simple task.
Additionally with "ex" you don't need a temporary file to write the changes to and you don't need to move the new file over on top of the original file!
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2005 01:42 AM
тАО06-09-2005 01:42 AM
Re: Awk expert's help needed (how to edit a text file?)
sorry about my earlier answer:
please replace grep with sed
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2005 01:44 AM
тАО06-09-2005 01:44 AM
Re: Awk expert's help needed (how to edit a text file?)
1: I want the phrase "work" to be added to lines that contains "htm" and are in lines 18 and after.
2: Harry, what language is that?
Thanks very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2005 02:00 AM
тАО06-09-2005 02:00 AM
Re: Awk expert's help needed (how to edit a text file?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2005 02:10 AM
тАО06-09-2005 02:10 AM
Re: Awk expert's help needed (how to edit a text file?)
As a courtesy, point assignment is the accepted way to say thank-you and indicate which response(s) was the best solution.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2005 02:13 AM
тАО06-09-2005 02:13 AM
Re: Awk expert's help needed (how to edit a text file?)
OK. It's not a LANGUAGE, it is a line editor:
man ex
where does "htm" exist? (at the beginning of the line, at the end of the line, in the middle?)
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2005 02:41 AM
тАО06-09-2005 02:41 AM
Re: Awk expert's help needed (how to edit a text file?)
I had no idea about the point system. I am pretty new to the Forum.
To clearify my question:
1-I have a text file, let's say a.txt
2-In line 18 and after, I'd like to add a phrase(let's say " /work/ " to the beginning of the line.
Thanks everyone again.