- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: extracting records from a data file
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
тАО12-10-2001 12:33 PM
тАО12-10-2001 12:33 PM
Along with that, I'm curious if there would be a way to direct records that don't have 'X' in them to another file...if the 2 files record count adds up to the original, I'm in like Flynn.
Thanks,
Joe Robinson
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2001 12:35 PM
тАО12-10-2001 12:35 PM
Re: extracting records from a data file
to get the opposite, all you have to do is grep -v ??????X
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2001 12:42 PM
тАО12-10-2001 12:42 PM
Re: extracting records from a data file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2001 12:44 PM
тАО12-10-2001 12:44 PM
Re: extracting records from a data file
sed '/[.]\{6\}X/p'
and those without a X at the 7th character:
sed '/[.]\{6\}X/d'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2001 12:45 PM
тАО12-10-2001 12:45 PM
Re: extracting records from a data file
grep "^??????X" file
grep -v "^??????X" file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2001 12:52 PM
тАО12-10-2001 12:52 PM
Re: extracting records from a data file
cat file | cut -c 7 | grep X
cat file | cut -c 7 | grep -v X
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2001 12:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2001 01:02 PM
тАО12-10-2001 01:02 PM
Re: extracting records from a data file
grep '^.\{6\}X' file
otherwise you will get it if X is the 8th, 9th, etc
the ^ will anchor it to the begining of the line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2001 01:17 PM
тАО12-10-2001 01:17 PM
Re: extracting records from a data file
awk '/^......X/ {print $0 >> "linesWithX";next} {print $0 >> "linesWithoutX";}'