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
10-24-2008 09:46 AM
10-24-2008 09:46 AM
Could you tell me the command for the following requirement,
I want to delete a line by finding a word AB at positions 431 and 432 in a file, and copy into a new file with the remaining lines.
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2008 10:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2008 10:02 AM
10-24-2008 10:02 AM
Re: grep
...and since you specifically mentioned 'grep' :
# grep -vE .{430}AB file > file.new
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2008 10:30 AM
10-24-2008 10:30 AM
Re: grep
The command you provide perl and grep is not working
below is the error I got with grep
grep -vE .{430}PA file > file.new
grep: Invalid {} repetition.
the line starts with "1" and at positions 431 and 432 we have P & A, I want to delete those line of that type in the file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2008 11:01 AM
10-24-2008 11:01 AM
Re: grep
OK, so the 'grep' gives:
grep: Invalid {} repetition.
This means that this version of 'grep' doesn't handle "large" repetions. That's why I suggested Perl in the first place, since it lacks silly limits. Adjust your counting to be from zero instead of one and use Perl.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2008 11:24 AM
10-24-2008 11:24 AM
Re: grep
I am sending a test file, please tell me how to delete a line
In the file first letter as "1" in red and "PA" in red, PA Starts at position 431, I want to delete those type of line in every file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2008 11:52 AM
10-24-2008 11:52 AM
Re: grep
which shouldn't ever be posted....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2008 04:32 PM
10-24-2008 04:32 PM
Re: grep
>This means that this version of grep doesn't handle "large" repetitions.
You can simply add up repetitions:
grep -v '^.\{200\}.\{230\}AB' file > file.new
>In the file first letter as "1" and "PA", PA Starts at position 431
If that "1" is important you can use:
grep -v '^1.\{200\}.\{229\}AB' file > file.new
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2008 06:22 AM
10-25-2008 06:22 AM
Re: grep
> Dennis: You can simply add up repetitions:
Yes, of course you can, but this is a nuisance. If the OP is fixed on 'grep', though, I agree that factoring is all that's left :-)
Then again, the above [ grep -vE .{430}PA file ] worked with GNU's 'grep' :-}}
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2008 07:34 AM
10-25-2008 07:34 AM
Re: grep
I tried with ur suggestions, but it failing and getting this error
grep: Invalid {} repetition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2008 07:45 AM
10-25-2008 07:45 AM
Re: grep
> I tried with ur suggestions, but it failing and getting this error:
grep: Invalid {} repetition
Well, I don't think you tried the factoring Dennis suggested! Empirical analysis suggests that the maximum repetition is 255. As I said, above, this is one choice; another is Perl; and yet another is GNU's 'grep'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2008 05:27 PM
10-25-2008 05:27 PM
Re: grep
255 is right there on the man page, regexp(5):
http://docs.hp.com/en/B2355-60130/regexp.5.html