10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Using a regular expression, I would like multiple lines to be matched.
By default, a period (.) matches any character except newline. However, (?s) and /s modifiers are supposed to force . to accept a newline and to match any character including a newline.
However, the following two perl... (4 Replies)
Discussion started by: LessNux
4 Replies
2. Shell Programming and Scripting
cat book.txt
book1 price 23
sku 1234
auth Bill
book2 sku 1233
price 22
auth John
book3 auth Frank
price 24
book4 price 25
sku 129
auth Tod
import re
f = open('book.txt', 'r')
text = f.read()
f.close()
m =... (2 Replies)
Discussion started by: chirish
2 Replies
3. UNIX for Dummies Questions & Answers
I have a very large file (over 700 million lines) that has some lines that I need to delete. An example of 5 lines of the file:
HS4_80:8:2303:19153:193032 153 k80:138891
HS4_80:8:2105:5544:43174 89 k88:81949
165 k88:81949 323 0 * = 323 0 ... (6 Replies)
Discussion started by: pathunkathunk
6 Replies
4. Shell Programming and Scripting
Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script...
I used sed to search a line and insert two blank lines after the searchd line using the following sed command.
sed "/data/{G;G;}/" filename . In the file, after data tag, two lines got inserted blank lines..... (4 Replies)
Discussion started by: arjun_arippa
4 Replies
5. Shell Programming and Scripting
Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script...
I used sed to search a line and insert two blank lines after the searchd line using the following sed command.
Sed "/data/{G;G;}/" filename. In the file, after data tag, two lines got inserted blank lines.. Now... (1 Reply)
Discussion started by: arjun_arippa
1 Replies
6. Shell Programming and Scripting
I would like to print 3 lines after a regular expression is found in the logfile. I'm using the following code:
grep -n "$reg_exp" file.txt |while read LINE ;do i=$(echo $LINE |cut -d':' -f1 ) ;sed -n "$i,$(($i+3))p" file.txt ;done
The above code things works fine,but sometimes gives erroneous... (3 Replies)
Discussion started by: joachimshaun
3 Replies
7. Shell Programming and Scripting
Hey, I found a way to print the lines which is just before a regular expression, not including the expression.
sed -n '/regexp/{n;p;}' myfile
Now I'm looking for a way to print all lines, exept the regular expression and also the line before the same regular expression.
Use code tags. (1 Reply)
Discussion started by: Livio
1 Replies
8. Shell Programming and Scripting
Hi,
I need a regular expression grepping all lines starting with '*' followed by a VARIOUS number of blanks and then followed by the string 'Runjob=1'.
I tried that code, but it doesn't work:
grep -i '*'+'Runjob=1' INPUT_FILE >>OUTPUT_FILE
Can someone help me?
Thanks (8 Replies)
Discussion started by: ABE2202
8 Replies
9. Shell Programming and Scripting
Hi i am trying to replace blank lines with a number 0. I tried the following code
awk '{print NF ? $0: blankrow}' blankrow = "0" file1.prg>file2.prg
however i get the following error: fatal: cannot open file `blankrow' for reading (No such file or directory)
file example:
1
2
3
5
6... (11 Replies)
Discussion started by: rockiefx
11 Replies
10. Shell Programming and Scripting
I am trying to use regular expression to identify ONLY the commands that hasn't the word "tablespace" within it. a command starts with "create table" and ends with ; (semicolon)
example file:
create table first tablespace ;
create table second
(
BBL_CUSTOMER_NAME VARCHAR2(32),
a... (7 Replies)
Discussion started by: ynixon
7 Replies