- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- perl question
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-20-2003 09:45 AM
10-20-2003 09:45 AM
How do write the below code in perl?
LN="rwxrwxr-x 3 oracle dba 96 Sep 16 16:48 datafile01.dbf";
FLNM=`echo $LN | awk '{print($9)}'`
I want to read the 9th column of the LN string.
Thanks.
ridzuan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2003 10:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2003 10:16 AM
10-20-2003 10:16 AM
Re: perl question
With an array, after a split:
perl -e '$_ = `ls -l x`; @words=split; print "$words[8]\n"'
Using a regular expression to remember in $1 the last series of non-spaces on the line:
perl -e '$_ = `ls -l x`; if (/\s(\S+)$/) { print "$1\n" }'
Using the same split but labeling the returned array with variables"
perl -e '$_ = `ls -l x`;($prot,$x,$group,$user,$size,$date1,$date1,$time,$name)=split; print "$name\n"'
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2003 10:22 AM
10-20-2003 10:22 AM
Re: perl question
In perl script:
$LN = "rwxrwxr-x 3 oracle dba 96 Sep 16 16:48 datafile01.dbf";
$name = (split (" ", $LN))[8];
Caesar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2003 10:32 AM
10-20-2003 10:32 AM
Re: perl question
$name = (split/\s+/)[-1];
why use external commands to get to file stuff? Because it's from a list? Good reason, otherwise use stat
Enjoy, have Fun! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2003 10:37 AM
10-20-2003 10:37 AM
Re: perl question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2003 10:48 AM
10-20-2003 10:48 AM