- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: output file redirect from sed is empty when ru...
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
05-23-2002 07:28 AM
05-23-2002 07:28 AM
output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
---sed part of script---
case "$OPTION_IN" in
.
.
.
f|F) sed -e 's/^/'"$Z"'/' file1 | tr -s "\n" " " > out1;
sed -e 's/^/'"$Z1"'/' out1 > out2;
sed -e 's/$/'"$Z2"'/' out2 > out3;
;;
q|Q) break ;;
*) echo "Invalid choice." ;;
esac
done
exit
----------------------
where Z1="some_text_string"
Z2="another_string"
Any help is appreciated.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 07:37 AM
05-23-2002 07:37 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 08:20 AM
05-23-2002 08:20 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 08:50 AM
05-23-2002 08:50 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
is unable to locate the end of line and therefore the whole file is end of line hence the odd behavior.
To stick to the proper behavior perhaps you would have to get a file containing $Z1$Z2 without no new line, but anyway, trying to substitute the end of the lines with something where there is no lines at all...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 09:10 AM
05-23-2002 09:10 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
----------
line 11111
line 22222
line 33333
----------
becomes:
----------
line 11111 line 22222
line 33333
----------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 09:15 AM
05-23-2002 09:15 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
HTH
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 09:20 AM
05-23-2002 09:20 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
example ..
sed '/^$/d'
I find this very useful, you might want to use it .. it's up to you..
http://www-h.eng.cam.ac.uk/help/tpl/unix/sed.html
hope it helps ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 09:58 AM
05-23-2002 09:58 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
and it works.I mean tr works as it should do.
Anyway, as it is used in the example it will not work (even behaving properly and replacing two or more \n with a single blank). The first sed inserts $Z at the beginning of each line, so no more groups of \n together.
tr -s '\012' < file1
works by the book, but again this is not just getting rid of the empty lines
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 12:11 PM
05-23-2002 12:11 PM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
I don't think there are any carriage return character (\r) in the out1 file. Only newline character. How can I check to see if there are any carriage return character.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 12:54 PM
05-23-2002 12:54 PM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
this will make the non-printable characters and control charactes visible:
cat -v {filename} |pg
HTH
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2002 07:31 AM
05-24-2002 07:31 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
Don't see any carriage return (\n) or new-line (\n) (But tab, new-line and form-feed are not suppose to show (from man cat).
Actual output of cat -v pout1 |pg.
----------------
string1 string2 string3
(EOF):
----------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2002 07:40 AM
05-24-2002 07:40 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2002 07:42 AM
05-24-2002 07:42 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2002 08:48 AM
05-24-2002 08:48 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
00000000 s t r i n g 1 = aa s t r i n g 2 = b
00000020 b
00000022
----------------------
don't see any \n or \r in out1 file.
In the file1 for the 1st sed, there are \n after each string ( s t r i n g 1 = a a \n)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2002 09:01 AM
05-24-2002 09:01 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
I would also use an eval to get rid of the hokey quoting that you are being forced to do.
I think you will get a better answer if you post some actual input, actual target and replacement strings, and a sample of your desired output. We are all on the same page then.
You probably should also indicate if other approaches (awk, perl, ...) are acceptable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2002 09:46 AM
05-24-2002 09:46 AM
Re: output file redirect from sed is empty when run from HPUX, Solaris7or AIX4.3
--re: command too long to process--
for this task, argument length is not a concern, but your comments are greatly appreciated.
-- sed is just not working when file have no \n (on unix side). I will try other approach.
We can stop posting for this post at this point. Once again, Thank you.