Search Results

Search: Posts Made By: cgkmal
2,030
Posted By cgkmal
You're rigth. Please use instead. awk...
You're rigth. Please use instead.


awk 'BEGIN{RS=">\n"} NF>=8{print $0">"}' file

Regards
2,030
Posted By cgkmal
Hi my_Perl, You can try: awk...
Hi my_Perl,

You can try:
awk 'BEGIN{RS=">\n"} NF>=8{print}' file
Regards
4,761
Posted By cgkmal
Hello asnandhakumar, One more option for...
Hello asnandhakumar,

One more option for you.
awk -F, 'FNR==NR {x[$1]=$0;next} z=($2 in x)?$0","x[$2]:$0 {print z; x[$2]=""}' file2 file1Regards
2,164
Posted By cgkmal
Hi James, Another option would be: awk...
Hi James,

Another option would be:
awk -F[”] 'BEGIN{print "FullName Age D.O.B Gender"}
/NAME/{A[$6]++; G[$10]++; print $4, $6, $8, $10}

END{ print "\nAge count\n"
for (i in A)...
3,011
Posted By cgkmal
Hi acsg, You can use sort command: sort...
Hi acsg,

You can use sort command:
sort -k1,1n -s inputfile
160 1
160 2
160 3
161 2
161 3
161 4
161 6
162 2
162 3
162 1

See "man sort" and you'll get that:
-k=Option to set the key...
1,947
Posted By cgkmal
Sure OMLEELA, I'll try to explain good...
Sure OMLEELA,

I'll try to explain good enough :D

I'm using gensub function with regexp back reference feature, This feature within gensub works something like this:

gensub(/regexp/,...
1,904
Posted By cgkmal
Hi nua7, Try with: awk -F"|" '{if($2!=$3)...
Hi nua7,

Try with:
awk -F"|" '{if($2!=$3) print}' inputfile

Regards
3,011
Posted By cgkmal
acsg, Try with: awk '{for(i=4;i<=NF;i=i+2)...
acsg,

Try with:
awk '{for(i=4;i<=NF;i=i+2) print $i,$(i+1)}' inputfile

Hope this helps.

Regards
4,552
Posted By cgkmal
Hi jontjioe, Another with awk: awk...
Hi jontjioe,

Another with awk:
awk '{nr=NR%2?(NR-1)/2+1:NR/2;a[NR]=$1}END{print a[nr]}' file1

Regards.
7,582
Posted By cgkmal
Hi yohasini, you can try to set a cron job...
Hi yohasini,

you can try to set a cron job with this options:
30 20 * * 2 Script.sh # every monday at 20:30

30 11 * * 2 Script.sh # every monday at 11:30
Regards.
Forum: Programming 03-30-2011
1,841
Posted By cgkmal
Hi stuggler, I'm not sure if you need...
Hi stuggler,

I'm not sure if you need something as follow, if so try with:
Sample: (There are some interlaced sequences)
cat inputfile
0, 0, 0, 56, 11
1, 524, 3, 6, 74
1, 624, 0, 43, 33
2,...
1,837
Posted By cgkmal
x="" for((i=1;i<=5;i++)) do x="$x $i" ...
x=""
for((i=1;i<=5;i++))
do
x="$x $i"
echo $x
done
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
and
for((i=1;i<=5;i++))
do
for ((j=1;j<=$i;j++))
do
echo -n "$i "
done
echo ""
done
13,382
Posted By cgkmal
Hi Kanus, I don't have access to SunOS...
Hi Kanus,

I don't have access to SunOS System, but I found man page of ls in the web. I see in SunOS doesn't have --time-style option. For that reason you receive that errors.

Reading the...
1,067
Posted By cgkmal
Hi vasanth.v, You can try with: awk...
Hi vasanth.v,

You can try with:
awk 'BEGIN{print "COl1|TIME|DATE|Config|FileName|FileSize|par"}
{sub(/ \(/,"(")}
/^Start line/{a=$3"|"$4"|"$5" "$6}
/^config/{a=a"|"$2"--"}
/File Name|File...
7,861
Posted By cgkmal
Hi saps19, An option could be: find ....
Hi saps19,

An option could be:

find . -name "*.tar" | nawk '!/\.\/country111/'

Regards
9,577
Posted By cgkmal
Hi locoroco, This sed line it seems to work ...
Hi locoroco,

This sed line it seems to work
sed 's/","/\n/g' inputAt the moment to open in open office, select " as "Text separator".

Hope it helps,

Regards.
32,267
Posted By cgkmal
Hi un1xl0ver_rwx, Another way could be: ls...
Hi un1xl0ver_rwx,

Another way could be:
ls -lR | awk '$7~/:/ && $1!~/^d/{print}' | wc -l
But the outputs are different between:
find . -type f | wc -land

ls -lR | awk '$7~/:/ &&...
845
Posted By cgkmal
Please try with: awk -v n=2 '/^NAME/{name++}...
Please try with:
awk -v n=2 '/^NAME/{name++} name >= n'inputfile
NAME STATE CPU(sec) CPU(%)
XXX -----r 55567 4.5
XXX -----r 55567 0.5
XXX -----r 55567 0.4
XXX -----r 55567 8.0
NAME STATE...
26,600
Posted By cgkmal
Hi tdw, Maybe trying with: echo "This is...
Hi tdw,

Maybe trying with:
echo "This is first line." | sed 's/\(^[A-Z]\)/foo\1/g'
fooThis is first line.

Regards.
2,180
Posted By cgkmal
Gimley, Try formating the output with sort: ...
Gimley,

Try formating the output with sort:
awk '{a[$1]+=$2}{b[$1]=$1" "a[$1]}END{for (c in b) print b[c]}' inputfile | sort -r -k2 -n
aaemaprakasa 2500
aaemaprakash 1494
aaemavati 754...
2,180
Posted By cgkmal
Hi gimley, I hope is what you need, try...
Hi gimley,

I hope is what you need, try with:
echo "John 60
John 20
John 30
Mary 1000
Mary 800
Mary 20" | awk '{a[$1]+=$2}{b[$1]=$1" "a[$1]}END{for (c in b) print b[c]}' | sort
John 110...
3,724
Posted By cgkmal
Hi hnux, Maybe: nawk...
Hi hnux,

Maybe:
nawk 'NR==FNR{a[$1]++}{if(!a[$1]) b[$0]=$0}END{for (c in b) {print c}}' file1 file2
ewebsync
global
metrics
mms
framework
ess
esign
mib
gchwf
mboards
esolutions...
14,568
Posted By cgkmal
Hi blink_w, Try with: awk '{for (i = 1; i...
Hi blink_w,

Try with:
awk '{for (i = 1; i <= NF; i++) a[i, NR] = $i}
END {for (j = NR; j > 0; j--){
for (i = NF; i >= 1; i--) printf("%s ", a[i, j])
printf("\n")}}' inputfile | awk '{sub(/^[...
6,494
Posted By cgkmal
Hi suryanarayana, Try with: awk...
Hi suryanarayana,

Try with:
awk 'BEGIN{FS=OFS="|"}{print $2,$1}' inputfile
xyz|abc
567|123
Regards
2,520
Posted By cgkmal
Hi mukeshguliao, Of course. Well, I detected...
Hi mukeshguliao,

Of course. Well, I detected something wrong when the original code I use worked with the sample data you put in
the thread body, but didn't work in the expected way with the file...
Showing results 1 to 25 of 36

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