Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: elixir_sinari
1,511
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
7,253
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,100
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...
1,973
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...
2,777
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).
2,743
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.
979
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
5,773
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).
1,699
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?
1,662
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).
1,490
Posted By elixir_sinari
May be: sed '/^#/!s/Test/&1/g' file
May be:
sed '/^#/!s/Test/&1/g' file
2,447
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,439
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"
3,543
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 "]"...
797
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,221
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;...
1,602
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...
1,202
Posted By elixir_sinari
Check the delimiters for substitution.
Check the delimiters for substitution.
980
Posted By elixir_sinari
Use nawk on Solaris.
Use nawk on Solaris.
1,426
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.
28,931
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...
1,475
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....
9,684
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])...
3,097
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...
1,691
Posted By elixir_sinari
Sweet...
Sweet...
Showing results 1 to 25 of 473

 

Featured Tech Videos

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