- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: grep the last string in a 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
тАО09-24-2009 04:16 AM
тАО09-24-2009 04:16 AM
Re: grep the last string in a file
sed 's/.*\.//' /tmp/portslist
Kind regards,
Kobylka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2009 04:20 AM
тАО09-24-2009 04:20 AM
Re: grep the last string in a file
>>Hein: If for some reason using "." as field separator does not work
>It works fine. One char field separators are fixed. If more than one, it is an ERE.
Right. Of course it works. I was not explicit enough.
I meant if it does not work for the exact usage.
You may have noticed how the questions and examples posted here do not always exactly match the real problem :-). Or perhaps a somewhat similar problem of a future reader.
The ERE can more readily be tweaked for more complex matches than a simple 'split'.
Jim wrote
>> perl -ne '@F=split /\./;print $F[@F-1]' file
Well, if you go that route, then you might as well use the build in autosplit ( -a + -F ):
$ perl -F'\.' -lane 'print $F[@F-1]' x
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2009 05:43 AM
тАО09-24-2009 05:43 AM
Re: grep the last string in a file
do
echo ${a##*.}
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2009 09:31 AM
тАО09-24-2009 09:31 AM
Re: grep the last string in a file
Regards
Vijay Chinnasamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2009 12:22 PM
тАО09-24-2009 12:22 PM
Re: grep the last string in a file
_Much_ too simple. (I might _never_ think of
it.)
- « Previous
-
- 1
- 2
- Next »