freelanceprogrammers.org Forum Index » Perl
How to get the value column of a File
Joined: 14 Jun 2004
Posts: 3
How to get the value column of a File
I`ve a file with some columns separate by a pipe, like this:
aaaa|bb|ccc|ddd|eee|fff|ggg|hhh|iii|jjj|kkk|lllll|mm|nn|o|pp|qqq|r|ss|
aaaa|bb|ccc|ddd|eee|fff|ggg|hhh|iii|jjj|kkk|llll|mm|nn|o|pp|qqq|r|ss|
aa|bb|ccc|ddd|eee|fff|ggg|hhh|iii|jjj|kkk|lllll|mm|nn|o|pp|qqq|r|ss|
aaaa|bb|cc|ddd|eee|fff|ggg|hhh|iii|jjj|kkk|lllll|mm|nn|o|pp|qqq|r|ss|
aaaa|bb|ccc|ddd|eee|ff|ggg|hh|iii|jj|kkk|ll|mm|nn|o|pp|qqq|r|ss|
I need to take the column with the letters "r". This file has different
lenght, means that, the letter "r" doesn`t have the same position.
Any idea how to do this?
Thanks in advance.
Dave.
Joined: 13 Aug 2005
Posts: 12
How to get the value column of a File
Hai David,
Greetings.....
Say your filename containing the below data is "data.txt", your code should be
like this.
open(TXT,"data.txt");
while(<TXT>)
{
if($_ =~ /r/)
{
$text .= $_;
}
}
close(TXT);
open(TXT,"output.txt");
print TXT $text;
close(TXT);
I hope you will definitely get a solution through this.
Thanks & Regards
Krish.
david_iraheta <david_iraheta@...> wrote:
I`ve a file with some columns separate by a pipe, like this:
aaaa|bb|ccc|ddd|eee|fff|ggg|hhh|iii|jjj|kkk|lllll|mm|nn|o|pp|qqq|r|ss|
aaaa|bb|ccc|ddd|eee|fff|ggg|hhh|iii|jjj|kkk|llll|mm|nn|o|pp|qqq|r|ss|
aa|bb|ccc|ddd|eee|fff|ggg|hhh|iii|jjj|kkk|lllll|mm|nn|o|pp|qqq|r|ss|
aaaa|bb|cc|ddd|eee|fff|ggg|hhh|iii|jjj|kkk|lllll|mm|nn|o|pp|qqq|r|ss|
aaaa|bb|ccc|ddd|eee|ff|ggg|hh|iii|jj|kkk|ll|mm|nn|o|pp|qqq|r|ss|
I need to take the column with the letters "r". This file has different
lenght, means that, the letter "r" doesn`t have the same position.
Any idea how to do this?
Thanks in advance.
Dave.
SPONSORED LINKS
Basic programming language C programming language Computer programming languages
The c programming language C programming language List of programming languages
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "perl_official" on the web.
To unsubscribe from this group, send an email to:
perl_official-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Regards,
Krish.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
[Non-text portions of this message have been removed]
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







