Search Results

Search: Posts Made By: daptal
8,680
Posted By daptal
creating excel file using perl
Hi ,

I am writing a simple excel file and want to create the file under say 'D:\Documents and Settings'. The problem with my code is it is writing in the same directory instead of the specified....
Forum: UNIX and Linux Applications 10-03-2011
3,872
Posted By daptal
did you try if it matches /\t+$/
did you try if it matches /\t+$/
5,497
Posted By daptal
sort -n -t" " -k1,3 *.csv Video...
sort -n -t" " -k1,3 *.csv


Video tutorial on how to use code tags in The UNIX and Linux Forums....
2,032
Posted By daptal
You get the additional rows when you skip the...
You get the additional rows when you skip the '/^\s*$/' line.

The line /^\s*$/ means any line that just contains white spaces or empty

If you notice your input file the format is as follows...
2,032
Posted By daptal
Using Perl : cat old_file | perl -e ' ...
Using Perl :

cat old_file | perl -e '
while(<>){
my ($chr,$gene,$count,$start) = split ;
print "$chr\t$gene\t$count\t$_\n" foreach (split(/,/,$start));
}
' > new_file

Using awk :
awk...
1,386
Posted By daptal
awk -F';' '{sub("-","",$4);sum+=$4; }END {print...
awk -F';' '{sub("-","",$4);sum+=$4; }END {print sum}' file


HTH,
PL
2,279
Posted By daptal
perl -e '$hash{`head -c 9 $_`} = 1 foreach (`ls...
perl -e '$hash{`head -c 9 $_`} = 1 foreach (`ls file*`);
> ((keys %hash) ==1) ? print "all three files are same\n" : print "all three files are not same\n";'



HTH,
PL
4,226
Posted By daptal
echo $mask_text SERVER/USERNAME,PASSWORD ...
echo $mask_text
SERVER/USERNAME,PASSWORD

cat abc.txt
Value1
Value2
server1/mylogin,mypasswd
Value3
Value4


sed "s#server1/mylogin,mypasswd#$mask_text#" abc.txt
Value1
Value2...
3,749
Posted By daptal
awk '{if ($0 ~ /^http:\/\/www*/) { print $0...
awk '{if ($0 ~ /^http:\/\/www*/) { print $0 ,"valid" } else { print $0 ,"invalid" }}' abc.txt


http://www.abc.com valid
http://abc.com invalid
http://123/a.html invalid...
5,650
Posted By daptal
#!/usr/bin/perl my %hash; while(<>){ ...
#!/usr/bin/perl

my %hash;
while(<>){
chomp;
my ($var,@arr) = split(",");
push @{$hash{$var}} , @arr;
}

my %prop_hash;
my $header = 1;

foreach my $var1(sort keys...
3
1,556
Posted By daptal
If you want to use perl here is the sol ...
If you want to use perl
here is the sol



cat test1 test2 test3 |
perl -e '
while (<>){
chomp;
my ($id, $num) =split("\ ");
push @{$hash{$id}}, $num;
}
foreach (sort keys %hash){ ...
4,227
Posted By daptal
can u specify an example of the output you want
can u specify an example of the output you want
3,718
Posted By daptal
If you want to use perl cat filename |...
If you want to use perl


cat filename | perl -e 'while (<>){
chomp;
my ($name,@numbers) = split("\ ");
my ($max,$min,$max_pos,$min_pos) = (0,0,0,0);
for (my $i=0;$i<=$#numbers;$i++){
if...
1,254
Posted By daptal
use a backslash for '+' $2 ~ /\+/{ ...
use a backslash for '+'


$2 ~ /\+/{



Another solution in perl



cat filename | perl -e 'while (<>){
chomp;
($word,$sign) = split("\ ");
if ($prev_sign && $prev_sign ne $sign){...
32,027
Posted By daptal
ssh -q atukuri@remotehostname 'find /home/atkuri...
ssh -q atukuri@remotehostname 'find /home/atkuri -name abc.txt -exec ls -l {} \;'
-rw-r--r-- 1 xxx users 49 2010-04-19 16:03 ./abc.txt

alternatively ls in find does a long listing by default
...
14,874
Posted By daptal
sed -ie 's/^[1-7,9] /1 /' filename ...
sed -ie 's/^[1-7,9] /1 /' filename




or


sed -e 's/^[^8] /1 /' filename



HTH,
PL
1,544
Posted By daptal
grep 'Cheque' MainFile.csv > TEMP.CSV ; sed -ie...
grep 'Cheque' MainFile.csv > TEMP.CSV ; sed -ie /Cheque/d MainFile.csv
27,213
Posted By daptal
sed -e 's/\s*//g' filename HTH, PL
sed -e 's/\s*//g' filename


HTH,
PL
12,081
Posted By daptal
awk -F '|' '{for(i=2;i<=NF;i++){ print $1.$i}}'...
awk -F '|' '{for(i=2;i<=NF;i++){ print $1.$i}}' filename


HTH,
PL
1,666
Posted By daptal
Try specifying the full path of sed in your shell...
Try specifying the full path of sed in your shell script
2,760
Posted By daptal
first check the manual of find to see if you want...
first check the manual of find to see if you want to use atime, ctime , mtime .


find . -ctime 14 -exec rm {} \;


Note before using rm do some check with ls to see if the output is what you...
2,031
Posted By daptal
print Dumper(@{$extractColumns{'2'}{'D'}}) ...
print Dumper(@{$extractColumns{'2'}{'D'}})

and
print Dumper(@{$extractColumns{'2'}{'M'}}

and see the values

Alternatively if you can paste the data or output it would be helpful
2,108
Posted By daptal
alternatively u can use rm ./-r from...
alternatively u can use

rm ./-r

from the directory it is present

HTH,
PL
1,940
Posted By daptal
What is the error you are getting? Try using...
What is the error you are getting?

Try using the full path for the password file if you are not executing from that directory.


Also not sure why you are using this


grep ^$/....



If...
Forum: Solaris 03-31-2010
21,839
Posted By daptal
LC_ALL=C ls -l | perl -e 'my %hash = ( "Jan"=>...
LC_ALL=C ls -l | perl -e 'my %hash = ( "Jan"=> "01" , "Feb" => "02" , "Mar" => "03" , "Apr" => "04"); # add other months
while (<>){
chomp; s/\s+/ /g;
my @arr=split(" ");
print "$arr[-1]\t";
my...
Showing results 1 to 25 of 171

 
All times are GMT -4. The time now is 03:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy