Search Results

Search: Posts Made By: elixir_sinari
4,369
Posted By elixir_sinari
You may try this: awk -F, 'FNR==NR{ if(NR>1)...
You may try this:
awk -F, 'FNR==NR{
if(NR>1) a[$1]=$0
next}
{if(FNR==1) next
$2 = ($2 in a ? a[$2] : "NOT FOUND") }
1' OFS=, file2.csv file1.csv
10,813
Posted By elixir_sinari
Try: perl -lne 'push @w, /\bA(?:BC|DF)_\w+/g;...
Try:
perl -lne 'push @w, /\bA(?:BC|DF)_\w+/g; END{ print join ", ", @w if @w}' ABC.txt
1,672
Posted By elixir_sinari
/\(.\)\1/!d : For all lines not matching the...
/\(.\)\1/!d :
For all lines not matching the pattern, delete the pattern space. The ! is for the pattern and not for the action d. This means that for all lines not having at least 1 consecutive...
3,525
Posted By elixir_sinari
A different type of Perl alternative (if you are...
A different type of Perl alternative (if you are interested):
perl -lpe '@a = split /(:)/, $_, -1; @a = map { ($_+1)%4 ? $a[$_] : "|" } 0..$#a if @a>3;
$_ = join("",@a)' file
This could be easily...
3,986
Posted By elixir_sinari
Did you read my post carefully? I said tr -d '\0'...
Did you read my post carefully? I said tr -d '\0' < inputfile and not what you tried.

And, ^@ is the ASCII representation of the null character (in caret notation).
8,695
Posted By elixir_sinari
Try using nawk instead of awk. Seems like the...
Try using nawk instead of awk.
Seems like the Solaris awk is accepting only a single-character FS.
1,916
Posted By elixir_sinari
You seem to be using ksh88, not ksh93. Try: ...
You seem to be using ksh88, not ksh93.
Try:

for i in ab.name.*
do
new=$(echo "$i"|sed 's/^ab/BOX/;s/\./_/g')
echo mv "$i" "$new"
done
9,246
Posted By elixir_sinari
Hi Don, may be you didn't read MadeInGermany's...
Hi Don, may be you didn't read MadeInGermany's reply carefully (or may be it was not well explained). I think he meant that $3=="" is equivalent to $3~/^$/ (the 2nd code fragment in his post).
2,968
Posted By elixir_sinari
What if the last field is the one to be excluded...
What if the last field is the one to be excluded from the output?
2,535
Posted By elixir_sinari
Why use cat at all? Use the shell itself...
Why use cat at all? Use the shell itself geo=$(<geom.txt).
2,537
Posted By elixir_sinari
May be: sed '/^#/!s/Test/&1/g' file
May be:
sed '/^#/!s/Test/&1/g' file
3,433
Posted By elixir_sinari
You've badly messed up the command line and the...
You've badly messed up the command line and the logic.

Try:
perl -i.old -ne 'print unless m:^\s*<string>com\.apple\.PhotoBooth</string>\s*$:' ~/Library/Compositions/Compound\ Eye.qtz

I...
1,930
Posted By elixir_sinari
Assuming ASCII data, try perl -F, -lape 'BEGIN...
Assuming ASCII data, try
perl -F, -lape 'BEGIN { ($tmpl = shift) =~ s/(\d+)/A$1/g }
$_ = pack($tmpl, @F)' "$COLUMNS" "$indir/input_file.dat" > "$outdir/output_file.dat"
6,190
Posted By elixir_sinari
That is incorrect. Check manual page for gawk. ...
That is incorrect. Check manual page for gawk.

@OP:
Check this:
gawk 'BEGIN{
field1="Sdddddfffffggggg"
split(field1,array,"")
print "Pattern : [" array[1] "]"
print "Field 1 :[" field1 "]"...
1,271
Posted By elixir_sinari
If you need the functionality of nohup, you could...
If you need the functionality of nohup, you could set a trap for SIGHUP to ignore it and ensure required redirections.
1,838
Posted By elixir_sinari
In bash, the piped processes run in sub-shells....
In bash, the piped processes run in sub-shells. So, the second exit 1 is only affecting the sub-shell running the while loop and not your whole script.

Try a variant such as:
...
while read i;...
2,232
Posted By elixir_sinari
Technically, the -> is a binary infix dereference...
Technically, the -> is a binary infix dereference operator. In your case, since the right side of the operator is neither an array/hash subscript nor a subroutine argument list, it implies a method...
2,748
Posted By elixir_sinari
Check the delimiters for substitution.
Check the delimiters for substitution.
1,611
Posted By elixir_sinari
Use nawk on Solaris.
Use nawk on Solaris.
2,197
Posted By elixir_sinari
Better to use $1 instead of $0 to avoid skipping...
Better to use $1 instead of $0 to avoid skipping some duplicate numbers due to leading/trailing whitespace.
40,895
Posted By elixir_sinari
In awk, systemreturns the exit status of the...
In awk, systemreturns the exit status of the command and not its standard output (unlike command substitution a.k.a. backticks). So, in your case, date will write to standard output wherever that is...
2,236
Posted By elixir_sinari
In these kinds of fora, others can judge your...
In these kinds of fora, others can judge your level of understanding only through what you mention in your posts; rarely anyone knows anybody else personally to make any appropriate presumptions....
15,532
Posted By elixir_sinari
Assuming that your dates are valid: perl...
Assuming that your dates are valid:
perl -MTime::Local=timelocal_nocheck -F/ -lape '$_ .= " --> " . (
timelocal_nocheck(0,0,0,$F[1],$F[0]-1,$F[2]-1900) - timelocal_nocheck(0,0,0,(localtime)[3,4,5])...
6,031
Posted By elixir_sinari
awk -F,...
awk -F, '{split($4,a,/\//);$4=sprintf("%02d/%02d/%s",a[1],a[2],a[3])}1' OFS=, file
@Yoda, that's assuming that the first 3 comma-separated fields never have any slashes.
And still its a broken...
2,459
Posted By elixir_sinari
Sweet...
Sweet...
Showing results 1 to 25 of 473

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