Search Results

Search: Posts Made By: uwork72
3,304
Posted By uwork72
Thanks vgersh99. The o/p is: file1...
Thanks vgersh99.

The o/p is:


file1 (here $2 rounded to 10,20,40 are present i.e. first 3 multiples)
-----
H1:12:90
k:12:b
t:18:n
n:22:i
k:42:b
s:48:s
a:41:b

file2 (remaining 50,70)...
3,304
Posted By uwork72
Thanks vgersh99 for this reply. Its a real help....
Thanks vgersh99 for this reply. Its a real help. Thanks.
But its producing 3 o/p files(with 2 multiples each), could you please point how can I make it produce 3 multiples entries in each file....
3,304
Posted By uwork72
split file with condition
$ cat file
H1:12:90
k:12:b
n:22:i
k:54:b
k:42:b
s:48:s
a:41:b
t:18:n
c:77:a
I am trying to split above file based on $2 such that if $2 is rounded to nearest 10's multiple (e.g. 10,20,30...
2,513
Posted By uwork72
total last digits
hi group,

How can I count total number of 5's which are continuous in the end. i.e. in the below string, the o/p should be 4

I just know to calculate total number of 5's

$ echo...
2,230
Posted By uwork72
split file with awk
I did a lot of search on this forum on spiting file; found a lot, but my requirement is a bit different, please guide.


Master file:

x:start:5
line1:23
line2:12
2:90
x:end:5
x:start:2...
4,548
Posted By uwork72
Thank you very much summer_cherry.Its really...
Thank you very much summer_cherry.Its really helpful.

Could you please help me in making it a kind of configurable i.e.

Something like:

X will contain the fields based on which Y fields...
4,548
Posted By uwork72
Rubin, My question was something like this. ...
Rubin,
My question was something like this.

I am trying to sum a few fields based on first 4 fields, something like this

.....
{ A1[$1 OFS $2 OFS $3 OFS $4 ] += $7;A2[$1 OFS $2 OFS $3 OFS...
4,548
Posted By uwork72
awk array index help
$ cat file.txt
A|X|20
A|Y|20
A|X|30
A|Z|20
B|X|10
A|Y|40

Summing up $NF based on first 2 fields,

$ awk -F "|" 'BEGIN {OFS="|"}
{ sum[$1 OFS $2] += $NF }
END { for (f in sum) print...
5,418
Posted By uwork72
Salil, do you have a solution to this ? I am not...
Salil, do you have a solution to this ? I am not sure why you are putting unnecessary comments on this post. A solution/help from you is much appreciated :-)
5,418
Posted By uwork72
x B 10 y B 12 z B 10 for A, all the...
x B 10
y B 12
z B 10

for A, all the third fields are same (10), same for C(0), but for B the 3rd fields are not same, so I wanted to print B section.
5,418
Posted By uwork72
Thanks Zaxxon and vgersh99 for the reply. I...
Thanks Zaxxon and vgersh99 for the reply.

I want to only print the section for which 3rd field is different (one section is basically based on second field, here A,B and C ).

x A 10
y A 10
z...
5,418
Posted By uwork72
awk check for equal - help
Input file:

x A 10
y A 10
z A 10
x B 10
y B 12
z B 10
x C 0
y C 0


Required output:

x B 10
y B 12
z B 10


i.e. printing only that section (based on 2nd field) for which third...
2,783
Posted By uwork72
Both the solutions worked fine, thanks a lot. ...
Both the solutions worked fine, thanks a lot.

But I am unable to supply a variable with double quote in the sed solution above.


e.g.

$ var=26
$ sed ":_
/begin/,/end/{
/end/!{
...
2,783
Posted By uwork72
delete line help
$ cat testf
line one

sec begin
id=25
details=ax
status=y
sec end

sec begin
id=26
details=ay
status=n
sec end

sec begin
id=28
details=am
status=n
sec end
2,051
Posted By uwork72
help with add
$ cat file
x A 10 20 30
x B 5 10 12
x C 10 4 5
x D 10 3 6
x K 10 23 4
x M 5 7 0
Req o/p:


x A 15 30 42
x C 20 7 11
x K 15 30 4
Basically I want to add up 2 rows values as above.


I...
1,387
Posted By uwork72
Can anyone help me for a generic solution here....
Can anyone help me for a generic solution here. i.e. replace column p of file1 with column q of file2
1,387
Posted By uwork72
The reason I asked, if I have to print 25 columns...
The reason I asked, if I have to print 25 columns in the output ?
1,387
Posted By uwork72
awk help
$ cat file1
A~1982~Y
X~1983~N
Z~1974~N

$ cat file2
S1~0
S2~1
S4~4

I have to replace the 2nd column of file1 with 2nd column of file2.

This is what I tried:


$ paste -d "~" file1...
2,080
Posted By uwork72
Danmero, thanks a lot.
Danmero, thanks a lot.
2,080
Posted By uwork72
time diff help
Input file:

Tue Oct 21 12:56:35 2008 Started
Tue Oct 21 12:56:39 2008 Completed
Tue Oct 21 12:57:25 2008 Started
Tue Oct 21 12:57:32 2008 Completed
Tue Oct 21 12:58:12 2008 Started
Tue Oct...
1,679
Posted By uwork72
Thanks radoulov for your reply. Thanks. ...
Thanks radoulov for your reply. Thanks.

Could you also suggest how can I keep any other lines (e.g. in the above file the line "#Test file" or any other intermediate comment lines) in the output....
1,679
Posted By uwork72
Delete help
Please give me some hints with awk or something, to delete the lines corresponding to a fixed 2nd field, for which A line is absent.


$ cat file.txt
#Test file

a 1 2232 ert
a 1 679 asd
A 1...
2,661
Posted By uwork72
cfajohnson, that worked perfectly fine for me....
cfajohnson, that worked perfectly fine for me. Thank you.
2,661
Posted By uwork72
Era, thanks for replying. I tried for only one...
Era, thanks for replying. I tried for only one entry in the input file; something like this


....
FILE=$1
fS=$(awk '{print $1}' $FILE)
((eS=fS+1))

echo "<Comp>" >> myxml
...
...
But I am...
2,661
Posted By uwork72
help xml
Group,



$ cat 2233
12236 ID2
12239 ID3

Please guide me to construct the following XML from the above input.


<Comp>
<main>
<hlp fS="12236" eS="12237">
...
Showing results 1 to 25 of 32

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