- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: awk field separator
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
08-20-2002 11:37 PM
08-20-2002 11:37 PM
I have a question about awk . Having a file like this
line 1
line 2
line 3
line 4
line next set of lines
line 7
line 8
line 9
line next set of lines ( and so on approx 7000 lines)
i use line next set of lines as recordseparator .
How do i tell awk that a single line should be one field ?
I was looking in the knowledge base but i did'nt find it there. Maybe i'm searching wrong.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 11:42 PM
08-20-2002 11:42 PM
Re: awk field separator
Try with this in the beginning of your script:
BEGIN { FS = \n }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 11:47 PM
08-20-2002 11:47 PM
Re: awk field separator
Prehaps you should change the Record separator to a single character.
BEGIN { FS=\n
RS=# }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 11:47 PM
08-20-2002 11:47 PM
Re: awk field separator
Thats what i already tried
and awk is responding with this :
syntax error The source line is 1.
The error context is
BEGIN { FS = >>> \ <<< n ; counter = 0 }
awk: The statement cannot be correctly parsed.
The source line is 1.
syntax error The source line is 1.
any idea ?
Reinhard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 11:51 PM
08-20-2002 11:51 PM
Re: awk field separator
Maybe my example is a little bit silly.
Real i use the single word "DBNAME" as record separator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 11:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 11:58 PM
08-20-2002 11:58 PM
Re: awk field separator
Check this:
awk ' BEGIN { RS="x"}^J{ print NR , $0 }' /tmp/87
__>1 line 1
line 2
line 3
line 4
line ne
__>2 t set of lines
line 7
line 8
line 9
line ne
__>3 t set of lines
RS is restricted to one char.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 11:58 PM
08-20-2002 11:58 PM
Re: awk field separator
You got it !!!
Thanks for your help.