- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Remove command
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
тАО02-15-2011 12:45 AM
тАО02-15-2011 12:45 AM
Remove command
#abc
#uid#
yti
#des
#fus
eue#
fds
Can advise if I want to check each line , if it begins or ends with # sign then remove this # sign , if not # , then do nothing ( also , if the # sign is in the middle of the line , then do nothing ) , only remove it if it is begin or end character , can advise what can i do ?
the file above should be changed to
abc
uid
yti
des
fus
eue
fds
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2011 01:22 AM
тАО02-15-2011 01:22 AM
Re: Remove command
you want to replace either linestart "^" followed by hash mark or hashmark followed by
line-end "$" with "nothing" .
That is by "sed":
# sed "s/^#// ; s/#$//" file > newfile
or by "perl":
#
perl -i -pe "s/^#// ; s/#$//" file
here replace the file "inplace" (-i)
see regexp(5), sed(1), perl(1)
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2011 01:39 AM
тАО02-15-2011 01:39 AM
Re: Remove command
if it is not # sign , do the same thing for " sign , how to do it ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2011 02:43 AM
тАО02-15-2011 02:43 AM
Re: Remove command
it is as easy as either:
# sed 's/^"// ; s/"$//' f
or mask the special char " by \"
# sed 's/^"// ; s/"$//' f
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2011 11:34 PM
тАО02-15-2011 11:34 PM
Re: Remove command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2011 01:06 AM - last edited on тАО09-19-2011 10:04 AM by Kevin_Paul
тАО02-16-2011 01:06 AM - last edited on тАО09-19-2011 10:04 AM by Kevin_Paul
Re: Remove command
Hi,
You have assigned points to 6 of 93 responses.
If answers you got were helful, you may want donate some points, they cost you nothing.
http://h30499.www3.hp.com/t5/help/faqpage/faq-category-id/kudos#kudos
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-18-2011 08:11 AM - last edited on тАО09-19-2011 10:05 AM by Kevin_Paul
тАО02-18-2011 08:11 AM - last edited on тАО09-19-2011 10:05 AM by Kevin_Paul
Re: Remove command
Hi HGH,
maybe you can visit this thread?
http://h30499.www3.hp.com/t5/General/Congrats-to-a-new-wiz-Hemmetter/m-p/4606244#M144980
:-)
V.