Search Results

Search: Posts Made By: rubin
32,982
Posted By rubin
Yes, 'cmp' does a byte by byte comparison of two...
Yes, 'cmp' does a byte by byte comparison of two files.


One way would be ...

# Build first the lists to be compared:

find /media/ntfsdrive/data/ /media/ext4drive/data/ -type f |
...
3,560
Posted By rubin
Maybe something like this, wd=10 awk -v...
Maybe something like this,
wd=10

awk -v wd="$wd" -F: '$NF=$NF-wd' OFS=: file > temp && mv temp file
Try it first on some test files.
7,100
Posted By rubin
If I correctly understand your requirement and...
If I correctly understand your requirement and assuming the above format of the big files,
awk '/^>[0-9]+$/ && c >=int(n/s) { k++; c=1; close(f) }
{ print > (f=FILENAME"_"k+1); c++ }' s=10...
3,084
Posted By rubin
perl -pe '$c=0; s/(@)/ ++$c<=3 ? $1 : " "/eg'...
perl -pe '$c=0; s/(@)/ ++$c<=3 ? $1 : " "/eg' file
7,454
Posted By rubin
Agreed, but the problem was originally stated...
Agreed, but the problem was originally stated differently .




[-]




This is a totally new element in the equation.

Glad you found a solution.
7,454
Posted By rubin
Maybe ls ...| xargs ... is not needed, but if...
Maybe ls ...| xargs ... is not needed, but if that's the case, then try:

printf "%s\n" file*.dat | xargs -n1 -p myscript.sh

Also the pause -1 records might need to be removed from the gnuplot...
5,621
Posted By rubin
Save the replacement text in a file ( say...
Save the replacement text in a file ( say repl_file ) and try,

perl -i.bak -0pe 's/rem.*?f is not null\n/qx(cat repl_file)/es' sql_file

Original file is saved in file.bak, just in case.
...
4,551
Posted By rubin
PMJI ..., but when nmap fails, it sends its...
PMJI ..., but when nmap fails, it sends its output to std error, not std out, so it needs to be redirected:

nmap -sP failedhost.com 2>&1 | nawk '/^[Ff]ailed/ { print $6 }'
3,659
Posted By rubin
Simply add another variable (say s3) in the loop,...
Simply add another variable (say s3) in the loop, and join them together later, ( ... output "$s2"-"$s3".pdf ... ).
Equally simple is modifying the posted perl code.
Forum: What is on Your Mind? 09-12-2009
29,896
Posted By rubin
Some unusual signs & mis-translations ...
Some unusual signs & mis-translations ...
3,659
Posted By rubin
Both solutions guessed the right format of the...
Both solutions guessed the right format of the spreadsheet file, and they worked OK. The problem is already solved.

P.S.
BTW, thanks for posting the file, I just wanted to confirm I was working...
3,659
Posted By rubin
Or ... $ cat sample 1-7 file_1.pdf 8-14...
Or ...

$ cat sample
1-7 file_1.pdf
8-14 file_2.pdf
15-22 file_3.pdf
23-30 file_4.pdf


while read s1 s2
do
pdftk file.pdf cat "$s1" output "$s2"
done < sample
3,659
Posted By rubin
Can you post ( say ...) first 10 lines of your...
Can you post ( say ...) first 10 lines of your spreadsheet file ? Exactly the way it is.
4,323
Posted By rubin
Given your input, one way would be: $ perl...
Given your input, one way would be:

$ perl -ne 'print $s=$s?",".$1:$1 if /Process ID (\d+):\d+ / && !$_[$1]++; print "\n" if eof' file
86,84,102
4,323
Posted By rubin
Another possible way, perl -ne 'print...
Another possible way,

perl -ne 'print "$1\n" if /Process ID (\d+):\d+ / && !$_[$1]++' file
4,345
Posted By rubin
awk -F, 'BEGIN { while (( getline < "file_2" )>0)...
awk -F, 'BEGIN { while (( getline < "file_2" )>0) a[$2]=$0 }
a[$2] { print $0 , a[$2] }' file_1 > newfile


or in a more traditional ( NR==FNR ) way,

awk -F, 'NR==FNR { a[$2]=$0;...
1,548
Posted By rubin
$ cat file 8 4001 4100 8 4101 4200 8 4201...
$ cat file
8 4001 4100
8 4101 4200
8 4201 4300
8 15901 16000
8 15910 16100
8 16910 16100

awk '$2-s > 100 && s {print RS $0; s=$2; next} s=$2' file


Output:

8 4001 4100
8 4101 4200
8...
1,581
Posted By rubin
Almost there ... awk '$1!=s && c { print s,...
Almost there ...

awk '$1!=s && c { print s, sum/c; sum=c=0 }
{ s=$1; c++; sum+=$2 }
END { print s, sum/c }' filename

Output:

1 3.51
2 7.17667
3 5.43
120...
6,800
Posted By rubin
awk needs an explicit declaration ( exit n ) of...
awk needs an explicit declaration ( exit n ) of its return status ... so assuming you don't have an END statement one way would be:

$ ls *.dat | awk -v COUNT=3 -v DIR="/tmp/invalid_dir/" 'BEGIN{...
6,138
Posted By rubin
Or making use of the fact that the files'...
Or making use of the fact that the files' timestamp is a pattern found first before the filenames and its length is fixed, another alternative would be:


awk '/^-[rwx-]/{ print...
4,292
Posted By rubin
OK, here it goes... #!/usr/bin/perl -w ...
OK, here it goes...

#!/usr/bin/perl -w

open (FILE,"data");
open (TMP,">data.tmp");

while (<FILE>) {
chomp;
s/\x95/replace/g;
print TMP $_...
6,060
Posted By rubin
Assuming the xml tag format will remain ( as...
Assuming the xml tag format will remain ( as described ) constant: <?xml + spaces + version="Nr-dot-Nr" + spaces + ?> , this might be enough:


awk '/^<\?xml( |\t)+version="[0-9]+\.[0-9]+"(...
4,292
Posted By rubin
To keep the code concise ( as is ), in bash or...
To keep the code concise ( as is ), in bash or the shell of your preference, you can do ...

#!/bin/bash

perl -pi -e 's/\xA5/replace/g' data.txt


Or if you want a pure perl script, then...
4,292
Posted By rubin
That's right ..., try something different...
That's right ..., try something different instead:

awk '{gsub("\x95","X")}1' file

perl -pe 's/\x95/X/g' file

____
EDIT: The hex code for the bullet is \x95
1,562
Posted By rubin
There needs to be another level of evaluation to...
There needs to be another level of evaluation to achieve that, so the function part will look like the following:

_func2(){
emt=test1_$1
emc=test2_$1
eval echo \$$emt
eval echo \$$emc
...
Showing results 1 to 25 of 308

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