The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to replace a specific word in specific column? ./hari.sh Shell Programming and Scripting 6 03-07-2009 09:33 AM
4 column tsv file, output 1 specific column casphar Shell Programming and Scripting 6 11-12-2008 04:04 PM
cut a specific value from a column sfaqih UNIX for Advanced & Expert Users 2 10-25-2008 06:08 AM
how do i parse by specific column? kmaq7621 Shell Programming and Scripting 2 09-02-2008 01:01 PM
subtitute specific column in line MomoChan Shell Programming and Scripting 11 08-26-2008 02:28 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-26-2009
wxornot wxornot is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 33
grabbing specific column perl

Alright,

I'm new to Perl so be gentle. Given the following script:
----
open(file, "<file.txt");

@lines = <file>;
close(file);

$var = print $lines[18];
----

So I'm printing line 18 of the file "file.txt". I now want the 5th column, minus the forward slash. The line looks like this:

TUV 1/ 3.2/ 4.5/ 3.1/

I tried doing:

print $var | perl -pae '$_="$F[5]\n"';, but i get garbage.

thanks in advance.
  #2 (permalink)  
Old 05-26-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,426
you are calling perl again inside your perl script. if you want to remove the slash, use s///g syntax.
check perldoc perlretut
  #3 (permalink)  
Old 06-01-2009
wxornot wxornot is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 33
not helpful

okay that post was not helpful in the least. I understand not to include perl in the string, I meant to take it out. any other help out there?
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0