10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to use awk to create (in this example) 3 seperate text file from the unique id in $1 in file, if it starts with the pattern aa. The contents of each row is used to populate each text file except for $1 which is not needed. It seems I am close but not quite get there. Thank you :).
... (3 Replies)
Discussion started by: cmccabe
3 Replies
2. Shell Programming and Scripting
Dear All,
I have 2 files. If field 1, 2, 4 and 5 matches in both file1 and file2, I want to print the whole line of file1 and file2 one after another in my output file.
File1:
sc2/80 20 . A T 86 F=5;U=4
sc2/60 55 . G T ... (1 Reply)
Discussion started by: NamS
1 Replies
3. UNIX for Dummies Questions & Answers
Hi all !
I almost did it but got a small problem.
input:
cars red
cars blue
cars green
truck black
Wanted:
cars red-blue-green
truck black
Attempt:
gawk 'BEGIN{FS="\t"}{a = a (a?"-":"")$2; $2=a; print $1 FS $2}' input
But I also got the intermediate records... (2 Replies)
Discussion started by: beca123456
2 Replies
4. Shell Programming and Scripting
It seems like a common task, but I haven't been able to find the solution.
vitallog.txt
1310,John,Hancock
13211,Steven,Mills
122,Jane,Doe
138,Thoms,Doe
1500,Micheal,May
vitalinfo.txt
12122,Jane,Thomas
122,Janes,Does
123,Paul,Kite
**OUTPUT**
vitalfiltered.txt
12122,Jane,Thomas... (2 Replies)
Discussion started by: charles33
2 Replies
5. UNIX for Dummies Questions & Answers
Howdy Folks,
I have a list that looks like this:
(file2.txt)
AAA
BBB
CCC
DDD
and there are 24 of these short words.
I am matching these patterns to another file with 755795 lines (file1.txt).
I have this code for matching:
awk -v f2=file2.txt '
BEGIN {
while(... (2 Replies)
Discussion started by: heecha
2 Replies
6. Shell Programming and Scripting
Hello UNIX experts,
I have 124 text files in a directory. I want to extract the 45678th line of all the files sequentialy by file names. The extracted lines should be printed in the output file on seperate lines.
e.g. The input Files are one.txt, two.txt, three.txt, four.txt
The cat of four... (1 Reply)
Discussion started by: yogeshkumkar
1 Replies
7. Shell Programming and Scripting
For example:
File 1:
abc def ghi
jkl mno pqr
File 2:
stu vwx yza
bcd efg hij
klm nop qrs
I want the reult to be:
abc def ghistu vwx yza
jkl mno pqrbcd efg hij
klm nop qrs (4 Replies)
Discussion started by: tamahomekarasu
4 Replies
8. Shell Programming and Scripting
I have a log file that I am trying to convert. File contents something like this:
aaaaa bbbbbb cccc dddddd\123 eeeee ffffffff
I am trying to output the fields in a different order and separate field 4 so that the "123" and "dddddd" can be output separately. for example
bbbbbb aaaaa 123... (5 Replies)
Discussion started by: jake1988
5 Replies
9. Shell Programming and Scripting
I have two files like
File1 : will get this file from "who" command. It is a unix file.
user val1 Jul 29 13:15 (IP Address1)
user val3 Jul 30 03:21 (IP Address2)
user val2 Jul 29 13:16 (IP Address3)
user val4 Jul 29 13:17 (IP Address4)
... (4 Replies)
Discussion started by: manneni prakash
4 Replies
10. Shell Programming and Scripting
hi,
i am facing a problem in merging two files using awk,
the problem is as stated below,
file1:
A|B|C|D|E|F|G|H|I|1
M|N|O|P|Q|R|S|T|U|2
AA|BB|CC|DD|EE|FF|GG|HH|II|1
....
....
....
file2 :
1|Mn|op|qr (2 Replies)
Discussion started by: shashi1982
2 Replies