LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-03-2013, 09:50 AM   #1
sumncguy
Member
 
Registered: Jun 2013
Posts: 76

Rep: Reputation: Disabled
Perl : extracting one file of a string


what is the perl equivalent to the follow Ksh code ?


Code:
str="camera               1676:790 (06/21/2012)           1676:790"
echo $str | sed 's/ +/ /g' | awk '{print $2}'
Thanks in advance
 
Old 12-03-2013, 10:30 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Code:
str="camera               1676:790 (06/21/2012)           1676:790"
echo $str | perl -nae 'print $F[1],"\n"'
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl Extracting 450000+ files in subdirs into single output file in current dir vamsiv Programming 2 10-05-2011 08:39 PM
Perl find file and then replace string in file moos3 Programming 5 07-29-2009 07:10 AM
AWK/Perl for extracting data from txt file to numerous other files briana.paige Linux - Newbie 2 05-05-2009 09:53 AM
Extracting chunks of data based on variables stored in another file (Perl?) mchriste Linux - Software 2 03-12-2009 12:44 PM
extracting first n characters of a string in perl ananthbv Programming 4 09-14-2004 07:25 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration