10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I am able to grep multiple patterns which stored in a files. However, how could we replace the whole line with either the pattern or new string?
For example:
pattern_file: *Info in the () is not part of the pattern file. They are the intended name to replace the whole line after the pattern... (5 Replies)
Discussion started by: wxboo
5 Replies
2. Shell Programming and Scripting
I need to check if 2 values exists in the file and if they are equal print 0.
output.txt:
------------
1 2 3 4 5 6
Inputs:
a=1
b=2
My pattern matching code works but I am trying to set a counter if both the pattern matches which does not work.If the count > 0,then I want to... (3 Replies)
Discussion started by: kannan13
3 Replies
3. Shell Programming and Scripting
Hi forum,
Can you please help me understand how to look for and replace the below pattern (containing line breaks) and return a new result?
Rules: Must match the 3 line pattern and return a 1 line result.
I have found solutions with sed, but it seems that sed installed in my system is... (5 Replies)
Discussion started by: demmel
5 Replies
4. Shell Programming and Scripting
Hi Team
I have the following text in one of the file
j1738-abc-system_id(in.value1)-2838 G566-deF-system_id(in.value2)-7489
I want to remove system_id(...) combination completely The output should look like this
j1738-abc-in.value1-2838 G566-deF-in.value2-7489
Any help is appreciated... (4 Replies)
Discussion started by: Thierry Henry
4 Replies
5. Shell Programming and Scripting
Hi Bigshots,
I have a pattern file with two columns. I have another data file. If column 1 in the pattern file appears as the 4th column in the data file, I need to replace it (4th column of data file) with column 2 of the pattern file. If the pattern is found in any other column, it should not... (6 Replies)
Discussion started by: ss112233
6 Replies
6. Shell Programming and Scripting
Hi,
I'm getting stuck when supplying multiple patterns for the below code:
awk -F, '
..
..
if ($0 ~ pattern)
{ .. .. }
..
..
' pattern='$ROW' input_file
for the same code I'm trying to supply multiple patterns as given below:
awk -F, '
..
..
if( ($0 ~ pattern) && ($0 ~... (6 Replies)
Discussion started by: penqueen
6 Replies
7. Shell Programming and Scripting
Hello,
I have the following input file:
qh1adm 20130710111201 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ
qh1adm 20130711151154 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ
qx1adm 20130711151154 : tp count QX1 u6 -Dsourcesystems=B17,E17,EE7
qh1adm 20130711151155 : tp import all... (7 Replies)
Discussion started by: kcboy
7 Replies
8. Shell Programming and Scripting
Hi,
I am using sub to remove blank spaces and one pattern(=>) from the input string. It works fine when I am using two sub functions for the same. However it is giving error while I am trying to remove both spaces and pattern using one single sub function.
Working:
$ echo " OK => " |awk... (2 Replies)
Discussion started by: sai_2507
2 Replies
9. UNIX for Dummies Questions & Answers
This should be somewhat simple, but I need some help with this one.
I have a bunch of files with tags on the end like so...
Filename {tag1}.ext
Filename2 {tag1} {tag2}.ext
I want to hold in a variable just the filename with all the " {tag}" removed. The tag can be anything so I'm looking... (4 Replies)
Discussion started by: kerppz
4 Replies
10. UNIX for Dummies Questions & Answers
Hi there,
We have been given a bit of coursework using awk on html pages. Without giving too much away and risking the wrath of the plagerism checks, I can say we need to deal with certain html elements.
There may be several of these elements on one line. My question is, if there are more... (1 Reply)
Discussion started by: Plavixo
1 Replies