pattern grep using Perl in .TSV file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting pattern grep using Perl in .TSV file
# 1  
Old 04-26-2010
Question pattern grep using Perl in .TSV file

Hi All,

I have a .TSV extension file having ~1 Gig data and I need to grep a pattern in that file using perl. I am not able to read the file using perl any suggestions on this/ If I Change the format my data gets mismangled so I am bothered about using specific format as well.

Code:
#! C:\programfiles\perl\bin\perl
    open(HANDLE,"<file1.tsv")or die "can't open file: $!";
    while ($record = <HANDLE>)
    {
      print $record;
     }
    close (HANDLE);


TIA,
-Senthil

Last edited by Franklin52; 04-26-2010 at 03:44 AM.. Reason: Please use code tags!
# 2  
Old 04-26-2010
Why can't you use grep ?
# 3  
Old 04-26-2010
having problems with recongnizing the file itself.
# 4  
Old 04-26-2010
Can you post a few lines from the file ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed and awk usage to grep a pattern 1 and with reference to this grep a pattern 2 and pattern 3

Hi , I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows. # diff mir_lex.c.modified mir_lex.c.orig 3209c3209 < if(yy_current_buffer -> yy_is_our_buffer == 0) { --- >... (5 Replies)
Discussion started by: breezevinay
5 Replies

2. Shell Programming and Scripting

Grep a file pattern in another

Hi I'm new to the forum, so I'd apologize for any error in the format of the post. I'm trying to find a file content in another one using: grep -w -f file1 file2 file1 GJA7 TSC file 2 GJC1 GJA7 TSC1 TSC (11 Replies)
Discussion started by: flyfisherman
11 Replies

3. Shell Programming and Scripting

How to grep a pattern in perl?

hello Everyone i am a newbie. i have a file which contains the following E:\gtmproj\script\i486_nt\obj\check_geomtools.exe: o:\portsrc\spg\system_1\i486_nt\advapps\TK-2\objmt\winclockmtq.lib E:\gtmproj\script\i486_nt\obj\check_geomtools.exe:... (12 Replies)
Discussion started by: Rashid Khan
12 Replies

4. Shell Programming and Scripting

Split each column in TSV file to be new line?

My TSV looks like: Hello my name is John \t Hello world \t Have a good day! \t See you later! Is there a simple bash script that splits the tsv on tab to: Hello my name is John Hello world Have a good day! See you later! I'm really stuck, would appreciate any help! (5 Replies)
Discussion started by: pxalpine
5 Replies

5. Shell Programming and Scripting

Grep pattern in PERL

Hi, Can anyone tell me how this grep works? Type of input is not known Thanks in advance (2 Replies)
Discussion started by: irudayaraj
2 Replies

6. Shell Programming and Scripting

script to grep a pattern from file compare contents with another file and replace

Hi All, Need help on this I have 2 files one file file1 which has several entries as : define service{ hostgroup_name !host1,!host5,!host6,.* service_description check_nrpe } define service{ hostgroup_name !host2,!host4,!host6,.* service_description check_opt } another... (2 Replies)
Discussion started by: namitai
2 Replies

7. UNIX for Dummies Questions & Answers

tsv file comparison

Hi Guys, I have to write a script to compare the tsv files headers with the values stored in the variable in bash. I have declared variables as HEADER_VERSION="All Versions\tVersion Type\tVersion\tLevel" now file contains data as follows: All Versions Version Type Version Level... (0 Replies)
Discussion started by: Swapna173
0 Replies

8. UNIX for Dummies Questions & Answers

Grep a pattern in gz file

I have a set of .gz files. I need to grep a pattern and need to find out the file in which that pattern occurs. zgrep in not available in my server.Any other options available for searching a pattern without unzipping the .gz files. (2 Replies)
Discussion started by: rprajendran
2 Replies

9. Shell Programming and Scripting

Split a file based on pattern in awk, grep, sed or perl

Hi All, Can someone please help me write a script for the following requirement in awk, grep, sed or perl. Buuuu xxx bbb Kmmmm rrr ssss uuuu Kwwww zzzz ccc Roooowwww eeee Bxxxx jjjj dddd Kuuuu eeeee nnnn Rpppp cccc vvvv cccc Rhhhhhhyyyy tttt Lhhhh rrrrrssssss Bffff mmmm iiiii Ktttt... (5 Replies)
Discussion started by: kumarn
5 Replies

10. Shell Programming and Scripting

perl pattern matching vs. grep

I originally had a shell script that did a grep 10 times to pull out the number of times a certain pattern occured in a file: ie... aOccurances=`grep aPattern file|wc -l` bOccurances=`grep bPattern file|wc -l` ... ... ... fOccurances=`grep fPattern file|wc -l` As the file got bigger with... (0 Replies)
Discussion started by: junkmail426
0 Replies
Login or Register to Ask a Question