- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: select fields from a report
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
тАО05-07-2002 06:50 AM
тАО05-07-2002 06:50 AM
A program generates a line of test delimited by |, I have now been asked to extract from this report a number of different fields namely the 4,6 and 10 (these may change from time to time). The fields are not of fixed length and the line can be over a 1000 characters long. I attach a portion of the line. Remember although the line may appear on many lines it is all contained in one line.
I look forward to your responses.
Thanking you
Dave
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2002 06:55 AM
тАО05-07-2002 06:55 AM
Re: select fields from a report
I would do something like:
# awk -F| '{ print $4,$6,$10 } filename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2002 06:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2002 06:56 AM
тАО05-07-2002 06:56 AM
Re: select fields from a report
cat filename|cut -d"|" -f4,6,10
or
cat filename|awk -F\| '{print $4," ",$6," ",$10;}'
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2002 06:56 AM
тАО05-07-2002 06:56 AM
Re: select fields from a report
awk -F\| '{print $4,$6,$10}'
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2002 06:57 AM
тАО05-07-2002 06:57 AM
Re: select fields from a report
cat filename | awk -F| '{print $4 $6 $10}'
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2002 07:02 AM
тАО05-07-2002 07:02 AM
Re: select fields from a report
I agree with Patrick on awk but you'll have to quote the pipe sign. Something like
awk -F '|' '{print $4 " " $6 " " $10}'
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2002 11:56 PM
тАО05-07-2002 11:56 PM
Re: select fields from a report
# awk -F '|' '{print $4, $6, $10}' fileToBeAnalzed
Will produce what you are looking for since each line within your file is not exceeding 3000 characters.
Magdi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2002 05:27 AM
тАО05-08-2002 05:27 AM
Re: select fields from a report
awk -F '|' '{print $4 " " $6 " " $10}'
is the simplest way to extract the columns.
Did this solve your problem ? OR you still want to load this extracted data to aother database/table ?
Raju