10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to match for the pattern '.py' in my file and print the word which contains.
For example:
cat testfile
a b 3 4.py 5 6
a b.py c.py 4 5 6 7 8
1.py 2.py 3 4 5 6
Expected output:
4.py
b.py c.py
1.py 2.py (3 Replies)
Discussion started by: Sumanthsv
3 Replies
2. Shell Programming and Scripting
I have the below plain text file where i have some result, in order to mail that result in html table format I have written the below script and its working well. cat result.txt
Page 2015-01-01 2000
Colors 2015-02-01 3000
Landing 2015-03-02 4000
#!/bin/sh LOG=/tmp/maillog.txt... (1 Reply)
Discussion started by: close2jay
1 Replies
3. Shell Programming and Scripting
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies
4. Shell Programming and Scripting
Hello,
I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies
5. Shell Programming and Scripting
Hi, I have text file:
Name: xyz
Gender: M
Address: "120_B_C; ksilskdj; lsudlfw"
Zip: 20392
Name: KLM
Gender: F
Address: "65_D_F; wnmlsi;lsuod;,...."
Zip:90233I want to insert 2 new lines before the 'Address: ' line deriving value from this Address line value
The Address value in quotes... (1 Reply)
Discussion started by: ysrini
1 Replies
6. Shell Programming and Scripting
Hi All,
I'm looking to use AWK to pattern match lines in XML file - Example patten for below sample would be /^<apple>/
The sample I wrote out is very basic compared to what I am actually working with but it will get me started
I would like to keep the matched line(s) unchanged but have them... (4 Replies)
Discussion started by: rhoderidge
4 Replies
7. Shell Programming and Scripting
Dear All,
I have a log file like below
13:26:31 |152.22
13:27:31 |154.25
13:28:31 |154.78
13:29:31 |151.23
13:30:31 |145.63
13:31:31 |142.10
13:32:31 |145.45
where values will be there from 00:00 hrs to 23:59 hrs. I'm matching for last occurance of 23:59 and printing 1440 lines (grep... (4 Replies)
Discussion started by: Naga06
4 Replies
8. UNIX for Advanced & Expert Users
Hi,
I have a patternfile with following pattern
cat
dog
cow
pig
Let's say I have thousand files
file0001
file0002
file0003
.
.
.
file1000
Each pattern can occur multiple times in multiple files. How can I search for pattern so the output of pattern and the filename is printed... (1 Reply)
Discussion started by: yoda9691
1 Replies
9. Shell Programming and Scripting
Hello all,
I need to print all the lines before a specific string and print a custom message 2 lines after that.
So far I have managed to print everything up the string, inclusively, but I can't figure out how to print the 2 lines after that and the custom message.
My code thus far is:... (4 Replies)
Discussion started by: SEinT
4 Replies
10. Shell Programming and Scripting
Ok, I'm too used to c/java. I want to go through a file to search for lines matching a given string using:
fgrep "matchString" anyfile.dat;
This works like it should, but I would like to record the lines in an array, rather than echo them. Any ideas? :eek:
Thanks.
P.S. I'm using ksh. (3 Replies)
Discussion started by: DrRo183
3 Replies