- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Adding new "column" into a txt file
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
тАО05-16-2002 05:43 PM
тАО05-16-2002 05:43 PM
I have a txt file which has the following form:
#cat myFile.txt
nwd.256.cr
nwd.sfv.67
nwd.tty.pp
... (& so on, all in vertical order)
I would like to add the pattern /fs36/ at the front of all the entries in myFile.txt.
Is there a utility which allows me to insert a pattern at the begining or anywhere in a file?
If so, could anyone provide some examples?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2002 05:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2002 05:58 PM
тАО05-16-2002 05:58 PM
Re: Adding new "column" into a txt file
The utility by default available on unix systems is sed.
sed 's/^/\/fs36\//g' myFile.txt > new_file
To append at the end replace ^ with $ in the above command.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2002 06:01 PM
тАО05-16-2002 06:01 PM
Re: Adding new "column" into a txt file
You could also use awk. Something like this should work, although I can't guarantee it since I'm not at a machine I can test on.
# awk '{ print "/fs36/" $0 }' yourfile.txt > your_new_file.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2002 06:06 PM
тАО05-16-2002 06:06 PM
Re: Adding new "column" into a txt file
and then
:1,$s/^/fs36 /g
You can get what you want