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
Forums
Discussions
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
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
06-30-2003 12:00 AM
06-30-2003 12:00 AM
Hi Folks
A small doubt regarding grep. I want to grep a line from a file. file goeas like this
skksjdfhglshdfgkdfmn
sdlfghsdklfgksdhfg
sdhgdfgghsdkfg
asd
skdjghkdjfg
aksjfhgkshdfgkdfd
I want to grep the last line. I know that line is starting with a, ending with d and many alphabets in between. how should I?
TIA
Shahul
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2003 12:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2003 12:08 AM
06-30-2003 12:08 AM
Re: grep
even more short:
cat TPURFILE| egrep ^a.*d$
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2003 12:08 AM
06-30-2003 12:08 AM
Re: grep
# tail -1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2003 12:10 AM
06-30-2003 12:10 AM
Re: grep
more "filename" | grep ^a |grep d$
Regards.
Ernesto.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2003 01:37 AM
06-30-2003 01:37 AM
Re: grep
just one more note: You don't have to use cat here. Just shorten your command to:
egrep "^a*d$" FILE
Regards Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2003 01:37 AM
06-30-2003 01:37 AM
Re: grep
you could try this:
# grep "^a[a-zA-Z].[a-zA-Z]*d$"
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2003 01:44 AM
06-30-2003 01:44 AM
Re: grep
And to throw in some perl :)
# perl -ne'/^a\w*d$/ and print' file
Enjoy, have FUN! H.Merijn