Search Results

Search: Posts Made By: rangarasan
2,009
Posted By rangarasan
You are almost done with it. awk ' ...
You are almost done with it.


awk '
NR == FNR {min[$1]=$3; max[$1]=$4; Gene[$1]=$NF; next}
{
for (id in min)
if (min < $2 && $2...
Forum: What is on Your Mind? 12-31-2015
1,472
Posted By rangarasan
Happy new year 2016 !!!! Have a great year ahead...
Happy new year 2016 !!!! Have a great year ahead !!!!

Cheers!
Ranga :)
14,126
Posted By rangarasan
Couple of things, You don't need to use cat to...
Couple of things, You don't need to use cat to pass the file content to awk. It's useless use of cat.

You can specify the single quote to get the shell variable interpolate.


awk -F,...
17,241
Posted By rangarasan
You need to allow the perl interpreter to...
You need to allow the perl interpreter to interpolate perl variables.

Just try this.!


system("wget -q --no-check-certificate -O /tmp/DataFile_$TimeStamp 'https://foobar.com/html' ") ;

...
1,613
Posted By rangarasan
Hi.. How about dynamic variable assignment. ...
Hi..

How about dynamic variable assignment.


perl -lne 'if(/exec/){$q="";$c=1;$qc++;}if($c){$q = join(" ", $q,...
1,704
Posted By rangarasan
Well, What have you tried so far? Anyways,...
Well, What have you tried so far?

Anyways, Here it is..

sed 's/^Delete_[0-9]*_//' file_name


-Ranga
1,277
Posted By rangarasan
Well, try sed -r 's#\.\.(/\.\.)*#%HOME%#'...
Well, try


sed -r 's#\.\.(/\.\.)*#%HOME%#' file


-Ranga
952
Posted By rangarasan
Hi,, Try something like this.. ...
Hi,,

Try something like this..



my @allipsfound ;
my %ips = ();
for my $elem (@gatches) {
my ($ip) = split ":",$elem;
$ips{$ip} = 1;
}
print join('\n', sort keys %ips), "\n";
8,377
Posted By rangarasan
sed
Hey,

Try sth like this,


sed 's#<head>\(.*\)</head>#\1#' input_file


In awk, you can specify more than delimiter in -F option or FS variable.


awk -F'[<>\t]' '{print $3,$6;}'...
7,322
Posted By rangarasan
You can use maxdepth option in find command to...
You can use maxdepth option in find command to search in current directory only.

Cheers!
-R
2,972
Posted By rangarasan
Just try the above code :) Cheers!!! -R
Just try the above code :)

Cheers!!!
-R
8,620
Posted By rangarasan
awk
Hi,
Try this one,

awk 'BEGIN{FS=",";}{if(a[$1]<$3){a[$1]=$3;}}END{for(i in a){print i","a[i];}}' file|sort -t',' -k1,1

if you are using gawk, make you of asort function to sort the array a and...
4,546
Posted By rangarasan
awk
Please use code tag for code and data samples.

Try smth like this.


awk -v ip=$(hostname -i) '/InternetProtocol/{print;getline;ip=">"ip"<";sub(/>.*</,ip);}1' input_file


Cheers!!!
-R
1,009
Posted By rangarasan
Have shortened a bit. Cheers! -R
Have shortened a bit.

Cheers!
-R
1,574
Posted By rangarasan
Hey!!! Welcome to the Unix and Linux...
Hey!!!

Welcome to the Unix and Linux Forum!!!!

Try someting like this,

First of all, you haven't mentioned, What shell you are using, Here you go with bash.


var=$(sed 's/.*roses \([^...
1,601
Posted By rangarasan
awk
Hey,

Try sth like this,


awk -F'\|' 'FNR==NR{a[$1]= $2"^"$3;next;}a[$2]{split(a[$2],b,"^");$6=b[1];$14=b[2];}1' OFS="|" file1 file2


Cheers,
Ranga:)
2,625
Posted By rangarasan
You have to do some more bit with radoulov's...
You have to do some more bit with radoulov's solution like this.

while read line
do
printf '%s\n' "${line%_*}_"
done <"input_file"


(or)

Try this sed,

sed 's/_[^_]*$/_/' input_file...
5,792
Posted By rangarasan
awk
Hey,

Try something like this,


awk '/^aa|^dd/{print $1,$4;}' file


Cheers,
Ranga:)
5,847
Posted By rangarasan
Please check the output of my command and not the...
Please check the output of my command and not the input file.


# awk -v l="15" '{s="%-"l"s\n";printf(s,$0);}' file|awk '{print length($0);}'
15
15
15


Cheers,
Ranga:)

---------- Post...
5,847
Posted By rangarasan
Hey, Welcome to The UNIX and Linux Forums, ...
Hey,

Welcome to The UNIX and Linux Forums,

Please use code tags for data samples and codes. code tag button look like https://www.unix.com/images/editor/code.png

You should use printf to...
1,108
Posted By rangarasan
nawk
Hey,

To format the output in nawk, you can use printf,

Here is the sample implementation,


echo 'Input string'|nawk '{printf("%s %20s\n",$1,$2);}'

Ouput:

Input string
...
2,429
Posted By rangarasan
perl
We can use these fetched values in integer expression and we don't have type cast and all in perl.

Cheers,
Ranga:)
2,429
Posted By rangarasan
perl
Hi,

Try this one,


open(FILE,"<","$xml_file_name");


while(<FILE>){
if($_ =~ m/accumId="(269|270)"/) {
my $accumId = $1;
my @inclUnits=split(/ /,$_);
my...
1,979
Posted By rangarasan
awk
Hi,

Try this one,


awk -F, '{a[$1]++;if(v[$1]){v[$1]=v[$1] ORS $0;}else{v[$1]=$0;}} END {for (i in a) if (a[i]>=2) print v[i]}' file



If you want to disply only the duplicated lines,

...
9,360
Posted By rangarasan
You are right dude :)
You are right dude :)
Showing results 1 to 25 of 125

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