Search Results

Search: Posts Made By: sk1418
18,673
Posted By sk1418
see the example below: ...
see the example below:



kent$ a=9.6532
kent$ [ $a -gt 0 ] && echo "ok"...
7,876
Posted By sk1418
awk '{printf $0}' yourFile | sed...
awk '{printf $0}' yourFile | sed 's#</string-array>#&\n#g'|awk '!a[$0]++'
2,282
Posted By sk1418
@linuxadmin...
@linuxadmin (https://www.unix.com/members/302093510.html)
what kind of output the command in #6 giving u?
here it looks quite similar with your expectation. :D
2,282
Posted By sk1418
does this work? run it under your src root. ...
does this work? run it under your src root.

grep -r -B2 -A3 "System.out.println" java|awk -F'-|:' '{if($1&&x!=$1){print $1;x=$1;} print $2}'
2,282
Posted By sk1418
aha! You want the output in your defined format,...
aha! You want the output in your defined format, not the infos grepped.

filename
codes...


you could try this:
grep -l "System.out.println" **/*.java > tmp.txt
this will list all filenames...
2,593
Posted By sk1418
kent$ echo '(line number) ...
kent$ echo '(line number) <word1><![CDATA[somethingelse]]></>'|sed -r '/word1/{s#(<\!\[CDATA\[).*(\]\]>)#\1something\2#;s#</>#<word1/>#}'
(line number) <word1><![CDATA[something]]><word1/>
2,543
Posted By sk1418
thanks for pointing this out. I didn't notice the...
thanks for pointing this out. I didn't notice the special 3rd line. ;)

your sed 's/|\(.*\)__abc|/|\1|/' tst works great for this example. however also not so generic.

e.g.
kent$ cat a...
2,543
Posted By sk1418
well if you have already touched sed, you were...
well if you have already touched sed, you were very close.

sed 's/__abc//2' file

will give you what you need. I guess the missing part was the "2", right?
1,795
Posted By sk1418
dirty and NOT generic solution: awk -F' NS' '{...
dirty and NOT generic solution:
awk -F' NS' '{ gsub(/\.$/,"",$1);split($1,a,".")} length(a)==2{b[$1]++;}END{for (x in b)print x}' yourFile
1,014
Posted By sk1418
kent$ awk 'NR==FNR{if(NR%2)getline a[$0]}...
kent$ awk 'NR==FNR{if(NR%2)getline a[$0]} NR>FNR{if($0 in a){i=$0;print;next;} if(a[i]){$0= a[i];i=0} print $0}' file1.txt file2.txt
T55
12
M977
57 62 78 94 96 107
T90
01 88
M1117
61 62 01...
6,931
Posted By sk1418
@panyam...
@panyam (https://www.unix.com/members/302047692.html)

Your $NF/a part is creative. however it will fail if the $3 is like

...
8000
8100
8200
8300
9000
...
6,931
Posted By sk1418
here it is: kent$ echo "1783747|091411|1000...
here it is:

kent$ echo "1783747|091411|1000
1783747|091411|2000
1783747|091411|2000
1783747|091411|2000
1783747|091411|3000
1783747|091411|4000
1783747|091411|5000
1783747|091411|6000...
1,275
Posted By sk1418
kent$ seq 10|awk '{f=(NR%2)==0?NR/2:int(NR/2+1);...
kent$ seq 10|awk '{f=(NR%2)==0?NR/2:int(NR/2+1); print > f".txt"}'

kent$ head {1..5}.txt
==> 1.txt <==
1
2

==> 2.txt <==
3
4

==> 3.txt <==
5
6

==> 4.txt <==
7
8

==> 5.txt...
2,906
Posted By sk1418
were you executing the awk line alone or putting...
were you executing the awk line alone or putting it into another script? are you sure you typed the command correctly?
123,678
Posted By sk1418
kent$ echo "Jobname Date Time Status abc...
kent$ echo "Jobname Date Time Status
abc 12/9/11 17:00 Completed
xyz 13/9/11 21:00 Running"|awk 'BEGIN{print "<table>"} {print "<tr>";for(i=1;i<=NF;i++)print "<td>" $i"</td>";print "</tr>"}...
2,906
Posted By sk1418
kent$ cat a stevie_db 13000 LIVE stevie_db...
kent$ cat a
stevie_db 13000 LIVE
stevie_db 13000 TEST
stevie_db 14000 DEVELOPMENT
john_db 25000 LIVE
john_db 25000 TEST
john_db 25000 DEVELOPMENT

kent$ awk '{if(!a[$1])a[$1]=$2; if...
873
Posted By sk1418
sort | uniq -c ---------- Post updated at...
sort | uniq -c

---------- Post updated at 14:15 ---------- Previous update was at 14:12 ----------

anchal_khare (https://www.unix.com/members/302026058.html) is faster. :)
1,048
Posted By sk1418
gsub(/[^ ]*cmi102 */,"")
gsub(/[^ ]*cmi102 */,"")
1,168
Posted By sk1418
maybe -F is also needed. grep -F -f file1 file2
maybe -F is also needed.
grep -F -f file1 file2
4,657
Posted By sk1418
how about in this way? find . -cmin 15 -a -name...
how about in this way?
find . -cmin 15 -a -name "yourfilename"
664
Posted By sk1418
is this what you want? kent$ echo...
is this what you want?
kent$ echo "BUNDLE1MB(6spaces)|Y|ng_oliv10@shellscript.com.ph(6spaces)562.60.61.20(6spaces)562.61.35"|sed 's/|/\t/g'

output:

BUNDLE1MB(6spaces) Y ...
1,374
Posted By sk1418
I was thinking about this way too, but it is not...
I was thinking about this way too, but it is not safe. e.g.

foo bar|2|3|a02 test|303
2|2 6|4|1002 a05 ind|3 y 03
4|3 x 8|5|ind|30
1,374
Posted By sk1418
kent$ echo "1|2|3|a02 test|303 2|2|4|1002 a05...
kent$ echo "1|2|3|a02 test|303
2|2|4|1002 a05 ind|303
4|3|5|ind|30"|awk -F'|' -v OFS='|' '{$4=gensub(/.* (.*) (.*)$/,"\\1\\2","g",$4);gsub(/ /,"",$4)}1'
1|2|3|a02test|303
2|2|4|a05ind|303...
10,855
Posted By sk1418
here I made an example, hope that it helps: ...
here I made an example, hope that it helps:

a sorted file (descending) named t

kent$ cat t
foo 100
foo 99
foo 98
foo 97
foo 96
foo 95
foo 94
foo 93
foo 92
....
foo 5
foo 4
foo 3...
10,855
Posted By sk1418
Ok. don't say etc. etc. how many "largest"...
Ok.
don't say etc. etc. how many "largest" numbers do you want?
2nd -- ?th
or all as long as possible?
Showing results 1 to 25 of 233

 

Featured Tech Videos

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