Search Results

Search: Posts Made By: bananamen
7,149
Posted By pamu
In my latest code I have not used substitute...
In my latest code I have not used substitute function. so there is no chance of X being replaced by ,

Please show us what you tried.



It is very difficult to program any script when you are...
2,656
Posted By ctsgnb
Does you input comes from a file that is...
Does you input comes from a file that is dynamically generated (so that its content changes) ?
or is your input taken from a configuration file whose content does not change ? (configured just...
2,656
Posted By bakunin
You can create an array. The basic way to create...
You can create an array. The basic way to create it is:

set -A ARRAYNAME $(some process with linewise output)

Run the following to get a feeling for this. I suggest you read the man page of...
2,656
Posted By RudiC
Try echo $INPUT | { IFS=":," read ST1 A ST2 B ST3...
Try echo $INPUT | { IFS=":," read ST1 A ST2 B ST3 C; echo $A $B $C $((A+B+C)); }
1 3 3 7
2,656
Posted By ctsgnb
Since ST1 ST2 and ST3 are unused you just can...
Since ST1 ST2 and ST3 are unused you just can scan one variable instead of 3
... | read x A x B x C
instead of
... | read x A y B z C

One more way
$ echo $INPUT
XXX:1,XXX:3,XXX:3
$ set --...
2,656
Posted By bakunin
First off: you shouldn't use backticks any more,...
First off: you shouldn't use backticks any more, they are deprecated in every modern shell. But that just as an aside, it shouldn't cause your problem.

The last "number" might be no number at all,...
7,149
Posted By pamu
In your code ' position is wrong it should be...
In your code ' position is wrong it should be like
awk '{sub()}' final.txt

try
awk -F, 'NR==FNR{A[$1]=$NF;B[$NF]=$(NF-1);next}{$(NF-1)=A[$3];$(NF-2)=B[$(NF-1)];sub(",XX,",",")}1' OFS="," file2...
7,149
Posted By pamu
Please check my previous post. I have corrected...
Please check my previous post.
I have corrected the code.
7,149
Posted By pamu
awk -F, 'NR==FNR{ #Reading file1 ...
awk -F, 'NR==FNR{ #Reading file1

A[$1]=$0;next} #Assign $0 to array A with index $1. Using next it skips the next code.

A[$2] # Check If the A[$2] is present or not....
7,149
Posted By balajesuri
awk -F',' 'NR==FNR {a[$1]=$2","$3; next} a[$2]...
awk -F',' 'NR==FNR {a[$1]=$2","$3; next} a[$2] {print $1","$2","a[$2]}' text1.txt text2.txt
7,149
Posted By pamu
have you tried with nawk ?
have you tried with nawk ?
Showing results 1 to 11 of 11

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