Search Results

Search: Posts Made By: sk1418
4,718
Posted By sk1418
how about in this way? find . -cmin 15 -a -name...
how about in this way?
find . -cmin 15 -a -name "yourfilename"
2,328
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}'
7,149
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...
2,955
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...
1,420
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
11,522
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...
1,472
Posted By sk1418
alternative awk '{print...
alternative
awk '{print $2;if($2~/H/){gsub(/H/,"M",$2);print $2;}}' yourFile|nl -nln
1,511
Posted By sk1418
kent$ cat a.tmp 1023~B~b~c~22~e~f~g~h~04/22/14...
kent$ cat a.tmp
1023~B~b~c~22~e~f~g~h~04/22/14
8910~A~b~c~0~e~f~g~h~07/29/11
8910~A~b~c~10.23448~e~f~g~h~07/29/11



kent$ awk -F'~' 'BEGIN{OFS="~"}$2=="A"{$5=($5==0)?$5:"-"$5}1' a.tmp...
11,522
Posted By sk1418
assumed that you have sorted the file. based on...
assumed that you have sorted the file. based on your example data:
kent$ echo "133 800
133 799
133 798
133 403
133 402
133 401"|awk 'NR==1{max=$2;next;}max-$2>5{print $0;exit;}'
...
1,107
Posted By sk1418
if all your filenames are in this pattern as your...
if all your filenames are in this pattern as your example, take a look the test and output below:
echo "T201108221033_P001736.Sep_5_1457.csv" |awk -F'[P.]' '{print $2}'
001736



if you don't...
1,242
Posted By sk1418
this would be what you need: awk -F,...
this would be what you need:

awk -F, 'NR==FNR{ a["["$1"]"]=$2} NR>FNR{ if($0 in a){ f =1;i=$0; print $0; next;}else{ $0 = "start_dt="a[i]; print $0; f=0;i=0; } }' file2 file1
output:
[title1]...
13,067
Posted By sk1418
I wrote an awk script to do the job, check if it...
I wrote an awk script to do the job, check if it is what you need:

under the directory of your bigFile:
touch {1..16}.txtthis will create 1-16.txt 16 empty files. then run this:
awk...
13,067
Posted By sk1418
are there only 16 <page>...</page> segments in...
are there only 16 <page>...</page> segments in your big file?
what is the rule of splitting :
for each
<page>
<title>foo</title>
[whatever]
</page>
you want to get a file containing info:...
3,128
Posted By sk1418
awk '/<x>/{srand(NR);v=rand()*50+1;printf ...
awk '/<x>/{srand(NR);v=rand()*50+1;printf "<x>%.13f</x>\n",v};!/<x>/'
3,128
Posted By sk1418
you can change the random seed to get different...
you can change the random seed to get different random number for your 'y'.
eg
awk '/y/{srand(NR*2);v=rand()*77+1;$0="<y>"v"</y>"};1' myfile.xml > filemod.xml
I think it would be ok. (I didn't...
3,128
Posted By sk1418
For your Q1: write the output to a new file is as...
For your Q1: write the output to a new file is as easy as:
awk ... inputFile > yourNewFileQ2: with precision control:
awk '/x/{srand(NR);v=rand()*50+1;printf "<x>%.13f</x>\n",v};!/x/'

you can...
3,128
Posted By sk1418
note that everytime your run this script, you get...
note that everytime your run this script, you get the same x value in same line. but in the file, every x-value should be unique. If you want to get different x-value in each run, change the srand...
1,261
Posted By sk1418
code: (without the header) awk...
code: (without the header)
awk 'NR>1{c3=$2*$2;c4=(1-$2)*(1-$2);c5=1-c3-c4;print $0,c3,c4,c5}' yourFile

output:
a 1 1 0 0
b 20 400 361 -760
c 30 900 841 -1740
d 3 9 4 ...
1,860
Posted By sk1418
does this help? awk '/msg=/{m=$0} /Exception/{...
does this help?
awk '/msg=/{m=$0} /Exception/{ if (m)print m; print $0; m=0}' yourLog.txt
767
Posted By sk1418
try grep -n "\.s" textfile
try grep -n "\.s" textfile
1,746
Posted By sk1418
basically, the command is NOT gonna print any...
basically, the command is NOT gonna print any file, that doesn't containing "
new DataBaseConnection" string. Can that be that the string in your java file as comment? so you think it should be the...
923
Posted By sk1418
put the two lines together in a file, then it...
put the two lines together in a file, then it could be single script.:D

grep -l "abc" **/*.txt|sed 's/$/ found/'
grep -vl "abc" **/*.txt|sed 's/$/ not found/'
923
Posted By sk1418
is this ok? grep -l "abc" *.txt|sed 's/$/...
is this ok?
grep -l "abc" *.txt|sed 's/$/ found/'
will print "filename found"

grep -vl "abc" *.txt|sed 's/$/ not found/'
will print "filename not found"
1,746
Posted By sk1418
does this work ? (not tested) find yourPath...
does this work ? (not tested)
find yourPath -name "*.java" |xargs awk '/try{/{t=1} /}catch/{t=0} (!t && $0~/new DataBaseConnection\(/){print FILENAME}'
2,364
Posted By sk1418
Originally Posted by sk1418...
Originally Posted by sk1418 https://www.unix.com/images/buttons/viewpost.gif...
Showing results 1 to 25 of 53

 

Featured Tech Videos

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