- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Some problem when I define RS
Operating System - HP-UX
1756989
Members
2012
Online
108858
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
Discussions
Discussions
Forums
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
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
тАО08-07-2008 05:13 PM
тАО08-07-2008 05:13 PM
Some problem when I define RS
Hi all,
I've run this on HP-UX and Solaris and it doesn't work while it actually works on Linux.
Pls check the following details:
*****************************************
$ more extract_test.dat
iTEM_ID||column_value||column1||colomn2@@
1111||aaaa||bbb||ccc@@
2222||cccc||ddd||eee@@
$ nawk 'BEGIN{FS="[|][|]";OFS="||";RS="@@\n";ORS="@@\n"}{print $0}' extract_test.dat
iTEM_ID||column_value||column1||colomn2@@
@@
1111||aaaa||bbb||ccc@@
@@
2222||cccc||ddd||eee@@
@@
@@
******************************************
Do you see that?
It seems that The shell doesn't recognize "@@\n" as record separator.
On Linux it's more like:
*******************************************
$ nawk 'BEGIN{FS="[|][|]";OFS="||";RS="@@\n";ORS="@@\n"}{print $0}' extract_test.dat
iTEM_ID||column_value||column1||colomn2@@
1111||aaaa||bbb||ccc@@
2222||cccc||ddd||eee@@
*******************************************
Do you have any idea to modify the command so I can have the same result on Solaris as on
Linux?
Thanks in advance
I've run this on HP-UX and Solaris and it doesn't work while it actually works on Linux.
Pls check the following details:
*****************************************
$ more extract_test.dat
iTEM_ID||column_value||column1||colomn2@@
1111||aaaa||bbb||ccc@@
2222||cccc||ddd||eee@@
$ nawk 'BEGIN{FS="[|][|]";OFS="||";RS="@@\n";ORS="@@\n"}{print $0}' extract_test.dat
iTEM_ID||column_value||column1||colomn2@@
@@
1111||aaaa||bbb||ccc@@
@@
2222||cccc||ddd||eee@@
@@
@@
******************************************
Do you see that?
It seems that The shell doesn't recognize "@@\n" as record separator.
On Linux it's more like:
*******************************************
$ nawk 'BEGIN{FS="[|][|]";OFS="||";RS="@@\n";ORS="@@\n"}{print $0}' extract_test.dat
iTEM_ID||column_value||column1||colomn2@@
1111||aaaa||bbb||ccc@@
2222||cccc||ddd||eee@@
*******************************************
Do you have any idea to modify the command so I can have the same result on Solaris as on
Linux?
Thanks in advance
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2008 06:20 PM
тАО08-07-2008 06:20 PM
Re: Some problem when I define RS
> It seems that The shell doesn't [...]
The shell or "nawk"?
"nawk" version on each system? OS version on
each system? (The OS version probably
doesn't matter, except as it might offer a
clue as to what you're using for "nawk"
everywhere, in case "nawk" came with one or
more of the OS's.)
> Do you have any idea to modify the command
> so I can have the same result on Solaris as
> on Linux?
Use the same ("nawk") program on each system,
and you probably wouldn't need to modify the
command anywhere?
If I were asking a question like that on an
HP-UX forum, I'd probably phrase it
differently.
The shell or "nawk"?
"nawk" version on each system? OS version on
each system? (The OS version probably
doesn't matter, except as it might offer a
clue as to what you're using for "nawk"
everywhere, in case "nawk" came with one or
more of the OS's.)
> Do you have any idea to modify the command
> so I can have the same result on Solaris as
> on Linux?
Use the same ("nawk") program on each system,
and you probably wouldn't need to modify the
command anywhere?
If I were asking a question like that on an
HP-UX forum, I'd probably phrase it
differently.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2008 08:34 PM
тАО08-07-2008 08:34 PM
Re: Some problem when I define RS
It seems that GNU awk works the way you want.
Otherwise, each line seems to be broken into 3 parts, the original and two blank lines.
Otherwise, each line seems to be broken into 3 parts, the original and two blank lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2008 04:04 AM
тАО08-08-2008 04:04 AM
Re: Some problem when I define RS
Hi:
OK, so it seems taht the input can be parsed about and recomposed to produce the same output on some platforms. Now, what are you really trying to solve?
It seems that 'awk' differs in its behavior on various opearating systems:
http://www.shelldorado.com/articles/awkcompat.html
If you want a tool that gives highly *consistent* behavior on a large number of platforms, *and* has superior regular expression support: use Perl.
Regards!
...JRF...
OK, so it seems taht the input can be parsed about and recomposed to produce the same output on some platforms. Now, what are you really trying to solve?
It seems that 'awk' differs in its behavior on various opearating systems:
http://www.shelldorado.com/articles/awkcompat.html
If you want a tool that gives highly *consistent* behavior on a large number of platforms, *and* has superior regular expression support: use Perl.
Regards!
...JRF...
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP