HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script - removing a symbol at the end of eac...
Operating System - HP-UX
1838936
Members
3213
Online
110131
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
02-01-2004 10:03 PM
02-01-2004 10:03 PM
shell script - removing a symbol at the end of each lines
HI,
I have a configuration file of the form shown below:
I would like to extract all fields from the configuration file, except the alphabet B, and any $ at the end of the lines, appearing after @ symbols of each line.
Therefore, the expected result would be:
host1 - DPG_SVLinux @AFS @SMP
host2 - DPG_SVLinux @AFS @BIG_MEM @CLASS_A
host3 - DPG_SVLinux @AFS
host4 - DPG_SVLinux @AFS
I have attempted to extract the fields by doing:
grep ^B config.*|cut -d ":" -f2 |sed s/^B// >outfile.txt
Note that I'm attempting to read a list of such configuration files in my direction having the same format as shown above (see attached file for full format of config file), and compiling all of such output into the file outfile.txt.
However, I'm not able to remove the $ string that appears after the @ symbols.
The current output looks as follows:
host1 - DPG_SVLinux @AFS @SMP $1
host2 - DPG_SVLinux @AFS @BIG_MEM @CLASS_A $1
host3 - DPG_SVLinux @AFS $2
host4 - DPG_SVLinux @AFS
Could anyone help me out by telling me how I should remove the $ symbol, if it appears at the end of each line?
Thanks
I have a configuration file of the form shown below:
I would like to extract all fields from the configuration file, except the alphabet B, and any $
Therefore, the expected result would be:
host1 - DPG_SVLinux @AFS @SMP
host2 - DPG_SVLinux @AFS @BIG_MEM @CLASS_A
host3 - DPG_SVLinux @AFS
host4 - DPG_SVLinux @AFS
I have attempted to extract the fields by doing:
grep ^B config.*|cut -d ":" -f2 |sed s/^B// >outfile.txt
Note that I'm attempting to read a list of such configuration files in my direction having the same format as shown above (see attached file for full format of config file), and compiling all of such output into the file outfile.txt.
However, I'm not able to remove the $
The current output looks as follows:
host1 - DPG_SVLinux @AFS @SMP $1
host2 - DPG_SVLinux @AFS @BIG_MEM @CLASS_A $1
host3 - DPG_SVLinux @AFS $2
host4 - DPG_SVLinux @AFS
Could anyone help me out by telling me how I should remove the $
Thanks
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2004 10:27 PM
02-01-2004 10:27 PM
Re: shell script - removing a symbol at the end of each lines
The sed string to remove that is
sed -e s/"\$[0-9]$"//g
the \ escapes the $ sign, and [0-9] means any matching digit.
The 2nd $ sign indicates an end of line marker.
sed -e s/"\$[0-9]$"//g
the \ escapes the $ sign, and [0-9] means any matching digit.
The 2nd $ sign indicates an end of line marker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2004 10:30 PM
02-01-2004 10:30 PM
Re: shell script - removing a symbol at the end of each lines
Hi,
try this.
Michael
try this.
Michael
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP