Hi miller,
Thanks for your response. This is something new that I have learnt.
User Profile
Collapse
-
Call java jar from perl script
Hi,
I have to call ' java -jar name.jar arg1 arg2' in my perl script. The java prints a string if we invoke the above command How to capture this information.
Thanks and regards. -
-
How to find if the number exists in a range?
Basically, I want to check whether $x is in between $y and $z.
I always compare them with simple if statement as below.
Code:if(($x > $y) && ($x < $z))
-
-
Hi,
Thx for your response. My data is tab delimited columns. Hence I wanted to grep lines with last column as 1. So I used (control+v then tab key to get
' $1' the last column which ends with 1. I will try with egrep. When I just use a she ll script with above description, it works and hence I constructed as system command inside my perl script. But it doesn't work as my syntax is wrong. Thanks again.Leave a comment:
-
shell command inside perl script
I am trying to use a shell grep command inside a perl script using system command as below.
Code:system "cat $source_path/s_${i}_${j}_0*testing.txt | grep ' $1' | head > $path/s_${i}_${j}.txt";
-
-
Getting argument as filename or STDIN
I am trying to read a file. The file contents can be either STDIN or a file name.
When it is from a file, I open as follows.
Code:Open filename ($filename) While(<$filename>){ #process each line }
Code:while(<>){ #process each line }
-
Echo statement inside the for loop is correctly printing the file path. But I get to to see theerror like "cat... No file found " three times because the path is broken. How can it happen? How can the path gets broken in the cat statement but not in echo statement. Please clarify. Thanks in advance.
Is there any problem because of line 11 and 12 of my code as I am trying to get the name of the file from directory path. No clue...Leave a comment:
-
doubts about shell scripting!
I am trying to concatenate some 100 files from one directory and writing them into another directory and I want to automate this as follows:
But cat statement inside for loop does not work. But echo statement inside the for loop shows the correct path to the files? Why is it not concatenating files? I am new to shell scripting. Thanks in advance.
Code:if [ $# -lt 4 ] then echo Usage:
-
perl merging data
Hi I need to merge my data as below and its highly confusing and please let me know how to do.
Code:3 131835844 131835943 3 131830073 131830172 18 33659786 33659885 18 33653576 33653675 2 146593375 146593474 2 146578884 146578983 3 83938058 83938157 3 83935615 83935714 4 46493910
-
remove lines from a huge text file
Hi,
I have a 10 million record in a tab delimited text file (data.txt) and I have another file with line numbers (line_num.txt).
My data.txt is as follows
Code:first 1 res 234 sec 23 fre 890 dec 26 der 690 ...
Code:23 456 3467 ...
-
-
Hi to be frank,
I have not used perl HoH before and still confusing after seeing some examples. I tried as beolw and am not able to achieve as I said above.
Code:while ( <> ) { chomp $_; @v = split(/\t/,$_); $bin = $v[2]; $key = $v[1]; $value = $v[1]; $HoH{$bin}{$key} = $value; }
Leave a comment:
-
-
perl hash data
Hi,
I have a doubt regarding perl hash data. I have a tab delimited as below:
file1.txt
Code:name1 AM bin1 name2 AM bin1 name3 PM bin1 name4 AM bin2 name5 AM bin1 name6 PM bin2
bin1 3AM 1PM
... -
Hi Jeff,
my sample test2.txt contains the following in the 13th and 35th column.
Code:57583225 57580491 57583262 57580492 58049166 58012648 57583215 57580442 59416357 59435981 56506459 56164151 63518481 63509149 58053224 58138139 59675405 60296224 59675408 60296279
Leave a comment:
-
perl search algorithm
Hi, there are two text files as below:
test1.txt
Code:53015910 53018079 53028477 53039398 53057449 53060200 53062918 53067636 53068725 53070903 53073104 53082405 53157340 53159848 53162114 53164278 53170778 53177010 53186077 53190880
-
Yes. Thank you so much for your response.
I managed to remove duplicates as below. A very simple way.
Code:%seen = (); while(<>){ $seen{$_}++; next if $seen{$_} > 1; print "$_"; }
Leave a comment:
No activity results to display
Show More
Leave a comment: