Search Results

Search: Posts Made By: daptal
8,989
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
5,073
Posted By daptal
did you try if it matches /\t+$/
did you try if it matches /\t+$/
5,807
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,278
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,278
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,471
Posted By daptal
awk -F';' '{sub("-","",$4);sum+=$4; }END {print...
awk -F';' '{sub("-","",$4);sum+=$4; }END {print sum}' file


HTH,
PL
2,453
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,592
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...
4,055
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...
6,071
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,722
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,553
Posted By daptal
can u specify an example of the output you want
can u specify an example of the output you want
4,189
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,297
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){...
33,122
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
...
15,351
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,667
Posted By daptal
grep 'Cheque' MainFile.csv > TEMP.CSV ; sed -ie...
grep 'Cheque' MainFile.csv > TEMP.CSV ; sed -ie /Cheque/d MainFile.csv
28,023
Posted By daptal
sed -e 's/\s*//g' filename HTH, PL
sed -e 's/\s*//g' filename


HTH,
PL
12,543
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,981
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,897
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,188
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,147
Posted By daptal
alternatively u can use rm ./-r from...
alternatively u can use

rm ./-r

from the directory it is present

HTH,
PL
2,011
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
22,647
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 07:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy