Note that if you put "sanpfound," in field 2 and then add in "dummy,"; you'll never find "dummy,snapfound".
If what you want is "snapfound" (which is not what you said you wanted in post #1 in this thread), you need to use "snapfound" in your first awk command.
You might want to consider the following single awk script as a possible replacement for your two awk scripts and a sed script:
but, of course, this assumes that your input file does already contain a ",dummy," that you want to get rid of, and that you want "snapfound," or "dummy," added before your device.
If file2 contains:
(with [as shown in post #1] or without the leading <space> on each line) and file1 contains:
(as shown in post #1), the above code will store:
as requested in post #1 in file-4 except that:
"dummy," is added before the device ID on lines with device IDs that do not appear in file2, and
"snapfound," is added before the device ID instead of "sanpfound," on lines with device IDs that do appear in file2.
As always, if someone wants to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
I hope this helps,
Don
This User Gave Thanks to Don Cragun For This Post:
I am trying to change the number in bold to 2400
01,000300032,193631306,190619,0640,1,80,,2/
02,193631306,000300032,1,190618,0640,CAD,2/
I'm not sure if sed or awk is the answer. I was going to use sed and do a character count up to that point, but that column directly before 0640 might... (8 Replies)
Source Code of the original script is down below please run the script and try to solve this problem
this is my data and I want it column wise
2019-03-20 13:00:00:000
2019-03-20 15:00:00:000
1
Operating System
LAB
0
1
1
1
1
1
1
1
1
1
0
1 (5 Replies)
Example:
I have files in below format
file 1:
zxc,133,joe@example.com
cst,222,xyz@example1.com
File 2 Contains:
hxd
hcd
jws
zxc
cst
File 1 has 50000 lines and file 2 has around 30000 lines :
Expected Output has to be :
hxd
hcd
jws (5 Replies)
I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file.
Here is the file.
<!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
I am developing shell script on Linux OS and I have two files.Data in each file is like :
File1 :
A B C
E F G
X Y Z
File 2:
A C 12
E G 22
X Z 41
I need if first and third column entries ( $1 & $3) of File1 in same row matches with first & second column... (3 Replies)
Hi Unix Experts,Team
I have a file (say comand_file.prm), The file has a command specified in column 6 (say "./execute_script.sh"). I want to execute this command in my script.
I am writing a KSH script to achieve this. Could you please assist me with this. (6 Replies)
Hi,
I have the following text file:
8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm
9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm
10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm
11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Hi,
I am having trouble converting a text file. I have been working for this whole day now, still i couldn't make it.
Here is how the text file looks:
_______________________________________________________
DEVICE STATUS INFORMATION FOR LOCATION 1:
OPER STATES: Disabled E:Enabled ... (5 Replies)