Search Results

Search: Posts Made By: mirni
3,031
Posted By mirni
No, you don't have it correctly. There are a...
No, you don't have it correctly. There are a couple problems with your line:
1. convert takes 2 filenames:
convert <inputfile> <outputfile>
If you want to perform the operation on the same file,...
3,380
Posted By mirni
Tricky part is that commas may be present within...
Tricky part is that commas may be present within the field (that's why the quotes)
Yoda's solution will not work for files that have more than 6 columns, or files that have commas in the last two...
4,010
Posted By mirni
You missed the type: find...
You missed the type:

find /local/home/app/cases -iname '*\.sh' -type f -exec chmod -c 744 {} \;
Escaping the period is not really necessary, and if there is a lot of files, using xargs is more...
Forum: Programming 02-12-2014
1,734
Posted By mirni
Fantastic! Thank you guys for pointing me in...
Fantastic!
Thank you guys for pointing me in the right direction!
Forum: Programming 02-12-2014
1,734
Posted By mirni
Signal out from fork()'d shell script back to the C++ application
Hi,
I am writing a C++ application; in which at one point I fork() a new process, which executes a shell script (via execv() call).
Now the shell script can take a while to finish (tarring, burning...
Forum: Programming 01-02-2014
2,007
Posted By mirni
Mount from C code with --no-mtab?
Hi all,
I am writing a mount/umount procedure for CD rom and getting into the problem that /etc/mtab is not in sync with /proc/mounts.
Then I am ending up with a bunch of dangling /etc/mtab entries...
20,325
Posted By mirni
From man ssh :
From man ssh :
4,216
Posted By mirni
Better yet, change IFS only locally, for this...
Better yet, change IFS only locally, for this while loop. And you can avoid the cutting if you just throw in another dummy variable:

while IFS='|' read first second rest ; do
echo $second ...
2,941
Posted By mirni
1,$ line range; apply the following command...
1,$ line range; apply the following command on all lines ('$' in this context means last line). This part can be omitted since the full range is default.
s/foo/bar/g substitute (s) 'foo'...
1,169
Posted By mirni
Or awk '{for(i=1;i<=NF;i++) $i=$i" "$i+1"...
Or
awk '{for(i=1;i<=NF;i++) $i=$i" "$i+1" "$i-1}1' numbers.txt
3,796
Posted By mirni
I agree that awk solution is more readable, but...
I agree that awk solution is more readable, but just for the heck of it, here is sed command that should do the trick:
sed 's/.*\("[^"]*"\).*/\1/'
1,346
Posted By mirni
Like this? awk '/^[^>]/ && length($0)<10{print...
Like this?
awk '/^[^>]/ && length($0)<10{print hdr"\n"$0}{hdr=$0}' input
1,203
Posted By mirni
May I ask what do you expect from testing against...
May I ask what do you expect from testing against the same condition twice?


Try:
awk -F- '/FAILURE/{if(!seen[$5,$6]){cnt[$5]++; seen[$5,$6]++; } if(cnt[$5]>10) print $5,$6}' logfileNote that...
1,205
Posted By mirni
Try egrep -m1 '/user/data/[0-9]{7}/'
Try
egrep -m1 '/user/data/[0-9]{7}/'
1,475
Posted By mirni
find /mahe -mmin -30 -ls
find /mahe -mmin -30 -ls
1,475
Posted By mirni
less than 30 minutes ago: -mmin -30 It's all in...
less than 30 minutes ago: -mmin -30
It's all in the manual: man find
1,475
Posted By mirni
You can use -mtime of find(1). -mtime -1 would...
You can use -mtime of find(1). -mtime -1 would list files newer than 24 hours. Alternatively, you can make a timestamp every midnight (from cron), and check with -nt, if your shell's test...
11,586
Posted By mirni
Perl and sed are not the same thing. Although I...
Perl and sed are not the same thing. Although I am quite rusty in Perl, this should do the trick:
perl -pe s'/([][])/\\$1/g'
4,241
Posted By mirni
Try this: awk ' {a[$1,$2]=$3; b[$1];} END{ ...
Try this:
awk '
{a[$1,$2]=$3; b[$1];}
END{
for(i in b) #print header
printf("\t%s",i);
printf("\n");
for(i in b) { #each row
printf("%s\t",i);
for(j in b) #each...
1,532
Posted By mirni
awk -F"[=,]" '{prev=$4; print; getline; print...
awk -F"[=,]" '{prev=$4; print; getline; print $0","($4-prev)/($4<0?-$4:$4)*100"%"}' input

The highlighted part basically does an absolute value of $4.
Note that you'll get into problems if the...
1,532
Posted By mirni
You can split on either = or , and hard-code 4th...
You can split on either = or , and hard-code 4th column:

awk -F"[=,]" '{prev=$4; print; getline; print $0","($4-prev)/$4*100"%"}' input
2,111
Posted By mirni
Or: cat inputfile | tr '\n' ' ' | sed 's/ CAR...
Or:
cat inputfile | tr '\n' ' ' | sed 's/ CAR /\nCAR /g; s/ $/\n/'
1,532
Posted By mirni
Try this: awk -F= '{prev=$NF; print; getline;...
Try this:
awk -F= '{prev=$NF; print; getline; print $0","($NF-prev)/$NF*100"%"}' input
2,461
Posted By mirni
Yes, it would, absolutely.
Yes, it would, absolutely.
1,858
Posted By mirni
What system are you on? What awk are you using? ...
What system are you on? What awk are you using?
If on Solaris, use nawk instead.
Showing results 1 to 25 of 500

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