Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: pamu
1,706
Posted By Jotne
request A123, valueA, valueB B234, valueA,...
request
A123, valueA, valueB
B234, valueA, valueB
C345, valueX, valueY
D456, valueX, valueY
E567, valueA, valueB
F678, valueA, valueB
G789, value A, valueB


Replacing file1 and file2 in...
1,834
Posted By Corona688
Incorrect, they take parameters just fine. ...
Incorrect, they take parameters just fine.

You call them directly, outside [ ], like you would an external program.

if g1 $1 $2 $3
then
...
else
...
fi

And your function should use...
10,290
Posted By Franklin52
Have you tried the gawk version for windows?
Have you tried the gawk version for windows?
10,290
Posted By balajesuri
Did you try cygwin?
Did you try cygwin?
1,144
Posted By Scrutinizer
Hi Kumar, from man printf: So ...
Hi Kumar, from man printf:



So

printf "%0*d" 10 "$b"
works like
printf "%010d" "$b"
2,294
Posted By Don Cragun
Thanks for the compliment, paum. But, after I...
Thanks for the compliment, paum. But, after I looked at it again in red, I see that it is more complex than it needs to be. That red line should be replaced with:
$i = $i != "" ? $i : (i...
2,294
Posted By Don Cragun
Hi pamu, I believe this meets all of Arun's...
Hi pamu,
I believe this meets all of Arun's updated requirements.

Could you explain why you thought you needed the NF>1 and the NF==1 tests in the first invocation of awk?

I'm not a big fan of...
1,417
Posted By Scrutinizer
See if this works: perl -pe...
See if this works:
perl -pe 's/(^|(?<=\|))([0-9.]+)\.(\||$)/$2$3/g' file
1,099
Posted By Scrutinizer
Alternatively: awk -F, '{A[$1]; B[$2];...
Alternatively:
awk -F, '{A[$1]; B[$2]; C[$1,$2]++} END{for(i in A){p=i; for(j in B)p=p FS j "=" C[i,j]+0; print p}}' file
986
Posted By elixir_sinari
With awk: awk 'FNR==NR{a[$0];next}{p=1;for(i in...
With awk:
awk 'FNR==NR{a[$0];next}{p=1;for(i in a) if($0~i) {p=0;break}}p' data2delete file2
5,928
Posted By Neo
Hey figaro, As I have replied; if you have...
Hey figaro,

As I have replied; if you have an icon you want to see, please create it or find it on the net and post it as an attachment. It must be 32 x 32 pixels.

In other words, if you...
990
Posted By Scrutinizer
awk version: awk 'NR==FNR{A[$1]; next}...
awk version:
awk 'NR==FNR{A[$1]; next} FILENAME!=ARGV[1] && $1 in A{print $0,FILENAME}' file * | sort -k1,1 -k4,4



--
@pamu: probably need to fix $x to avoid incomplete matches, for example:...
Forum: What is on Your Mind? 10-18-2012
1,276
Posted By Neo
Hi amora, Thank you for those kinds words. ...
Hi amora,

Thank you for those kinds words. You make me and all the other team members feel good about the work we all put into these forums.

I know it sounds a bit overstated; but often when I...
1,811
Posted By Scrutinizer
One awk: awk ' f==2{ F2[$2]=$8 ...
One awk:

awk '
f==2{
F2[$2]=$8
}
f==3{
F3a[$2]=$9
F3b[$2]=$10
}
f==1{
$8=F2[$2]
$9=F3a[$2]
$10=F3b[$2]
print
}
' f=2 file2 f=3 file3 f=1 file1
1,874
Posted By elixir_sinari
Why do you simplify your problems? Just state...
Why do you simplify your problems? Just state them as they are.
awk '{a[NR]=$0}
END{h=(NR%2)?int(NR/2+1):(NR/2)
j=h+1
for(i=1;i<=h;i++)
print a[i],a[j++]
}' OFS=: tmp.txt
3,202
Posted By elixir_sinari
There is a big difference between how you handle...
There is a big difference between how you handle files and variables. You mention variables in one post (and in the thread title) and files in the other.

Please don't try to oversimplify the...
2,068
Posted By asavaliya
Just Amazing ...............just...
Just Amazing ...............just awesome................

Thanks a lot ....You r genius :):):):):):):):)
3,535
Posted By jim mcnamara
in bash try: type [ type [[ They...
in bash try:

type [
type [[


They are both part of the shell: [ is a keyword like if, while, etc.: [[ is a shell builtin but still is treated a a word.

"word" is key here, because words...
3,535
Posted By elixir_sinari
What is that, pamu? Variable expansion will be...
What is that, pamu?
Variable expansion will be done by the shell in any case (in case of double-quotes). The double-quotes are to retain the embedded spaces and/or to tell the shell that the...
1,282
Posted By Don Cragun
Try the following: awk -F "(<[/]*tag|>)" ' { ...
Try the following:
awk -F "(<[/]*tag|>)" '
{ for(i = 2; i <= NF; i += 4) {
o[NR,$i] = $(i + 1)
if($i > maxf) maxf = $i
}
}
END { for(i = 1; i <=...
693
Posted By elixir_sinari
awk -F,...
awk -F, 'BEGIN{split("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",mname,",")
for(i=1;i<=12;i++) mnum[mname[i]]=i}
{mon=mnum[substr($3,1,3)];yr=substr($3,4,2);
$0=$0"/"$4;for(i=1;i<=$4;i++){
...
1,467
Posted By Corona688
Yes, this is how if is meant to be used. It...
Yes, this is how if is meant to be used. It checks the return status of the command given.

If in doubt, remember, [ is a command.

$ whereis '['

[: /usr/bin/[

$ Usually a shell builtin,...
3,026
Posted By elixir_sinari
Now, what does that mean (NR being always same)?...
Now, what does that mean (NR being always same)? That might not work only because ! has a higher precedence than %. So the expression !NR%60 is evaluated as follows:
1) Negate the value of NR. This...
4,129
Posted By A-V
FILES01="F1/*" for T in $FILES01 do ...
FILES01="F1/*"
for T in $FILES01
do
name=$(basename $T)
for X in james mark john peter sam
do
for Y in james mark john peter sam
do
for Z in james mark john peter sam
do

if [[ `grep...
7,896
Posted By elixir_sinari
Turn on extglob (shopt -s extglob).
Turn on extglob (shopt -s extglob).
Showing results 1 to 25 of 55

 

Featured Tech Videos

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