- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- question on replacing blanks with other values
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
Forums
Discussions
Discussions
Discussions
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
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-27-2002 08:02 AM
06-27-2002 08:02 AM
Thanks
Narasimham
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:05 AM
06-27-2002 08:05 AM
Re: question on replacing blanks with other values
Pete
Pete
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:06 AM
06-27-2002 08:06 AM
Re: question on replacing blanks with other values
This Word doc should help:-
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:07 AM
06-27-2002 08:07 AM
Re: question on replacing blanks with other values
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:10 AM
06-27-2002 08:10 AM
Re: question on replacing blanks with other values
Sorry that will replace blank spaces - question is blank LINES ?
A blank line could contain many spaces or unprintable chars.
Perhaps an example of the file will help more - can you attach one?
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:12 AM
06-27-2002 08:12 AM
Re: question on replacing blanks with other values
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:13 AM
06-27-2002 08:13 AM
SolutionThis command will replace all blank lines in a file to "y".
#sed s/^$/y/g file
Here "s" is for replacing
"^$" represents blank line
"g" is for global replacement. If g is not there, it will replace only the first occurence of blank line.
I hope now U are clear.
Best of luck
Shahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:14 AM
06-27-2002 08:14 AM
Re: question on replacing blanks with other values
Treating blanks, tabs and newline characters and their combinations as "blank" lines, you can do:
# sed -e 's/^[ ]*/0/'
Note that this is typed as "[", a blank (space) character, a tab character and a "]".
Regards!
...JRF...
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:15 AM
06-27-2002 08:15 AM
Re: question on replacing blanks with other values
cat filenaem | sed -e "1,$ s / /0/g "
the tip is that try it in vi mode and then use the same string in quotes with sed -e , most of the time it works cool.
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:17 AM
06-27-2002 08:17 AM
Re: question on replacing blanks with other values
tr ' ' '0' < oldfile > newfile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:21 AM
06-27-2002 08:21 AM
Re: question on replacing blanks with other values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:24 AM
06-27-2002 08:24 AM
Re: question on replacing blanks with other values
;^)
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:26 AM
06-27-2002 08:26 AM
Re: question on replacing blanks with other values
Isn't it Monday then ----
It certainly feels like it.
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:33 AM
06-27-2002 08:33 AM
Re: question on replacing blanks with other values
I was off yesterday. Maybe that's why it seems like Monday but then, don't they all? I didn't think that would disable my ablity to read my native language but you never know, I guess.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 08:46 AM
06-27-2002 08:46 AM
Re: question on replacing blanks with other values
Oops, Monday is must be for me too! I dropped the "$" anchor:
# sed -e 's/^[ ]*$/0/'
Again, note that this is typed as "[", a blank (space) character, a tab character and a "]".
By the same token:
# sed 's/^$/0/g'
...should also be:
# sed 's/^$*/0/g'
Regards!
...JRF...