But mine is slightly different and still works.
Is my solution improper in any way?
Fas
Saw your post after my answer!
---------- Post updated at 03:04 PM ---------- Previous update was at 03:03 PM ----------
Will do!
The differences between:
and:
are:
the 1st form reads the data in split twice and writes the data in split twice while the 2nd form reads and writes the data once,
the 1st form uses two processes while the 2nd form uses one process,
the 1st form will transform any line containing the string varchar followed by zero of more arbitrary characters followed by a ) and a <space> while the 2nd form changes the <space> character in the string varchar(30) Select to a <newline> character (as specified in the 1st post in this thread),
the 1st form uses more system resources than the 2nd form,
the 1st form runs slower than the 2nd form, and
the 1st form will work on some systems that change a \n in a sed substitute command replacement string to a <newline> character and on systems with a standards conforming version of sed will print varchar(30)nSelect (note the n instead of the requested <newline>) while the 2nd form should do what you want with any sed.
Also, compare the results you get from the two above scripts with the input:
I assume that your input file won't have anything that has more than one closing parenthesis on a line containing the string varchar, but the 1st form will give you something you don't want if that should ever occur. The 2nd form only transforms the text you said you wanted to transform.
This User Gave Thanks to Don Cragun For This Post:
I want to search a file for a string and then if the string is found I need the line that the string is on - but also the previous two lines from the file (that the pattern will not be found in)
This is on solaris
Can you help? (2 Replies)
Hello all.
Sorry, I know this question is similar to many others, but I just can seem to put together exactly what I need.
My file is tab delimitted and contains approximately 1 million rows. I would like to send lines 1,4,& 7 to a file. Lines 2, 5, & 8 to a second file. Lines 3, 6, & 9 to... (11 Replies)
Hi all
I am searching for a pattern in a file .
The file content is in a single line.If am doing a grep or sed for the a particular pattern am getting whole file.
I want the result in different lines.
attaching the file for reference
search pattern "/xxxxxx/hhhh/tttttttt/sss/" and... (4 Replies)
Hi,
I am new to ksh scripting and I have a problem.
I have a file in which I have to search for a particular pattern say 'a' then from that line I need to search for another pattern say 'b' in the previous lines and thne print the file from pattern 'b' till the end of file.
For eg:
... (2 Replies)
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
I have hundreds of files to process. In each file
I need to look for a pattern then
extract value(s) from next line and then
search for value(s) selected from point (2) in the same file at a specific position.
HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V
TITLE CYTOCHROME... (7 Replies)
Hi,
I have a file which contains the below details.. My requirement is to fetch all the lines which are starting with "ABC_XY_" into 1 file and rest of the lines (not starting with "ABC_XY_") into another file.
Could you please help with what command needs to be used?
file1.txt
----------... (12 Replies)
Hi
i have requirement like below
M <form_name> sdasadasdMklkM
D ......
D .....
M form_name> sdasadasdMklkM
D ......
D .....
D ......
D .....
M form_name> sdasadasdMklkM
D ......
M form_name> sdasadasdMklkM
i want split file based on line number by finding... (10 Replies)
Hi All,
i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field.
i am using centos 7 Operating system.
want to read below file.
# cat /tmp/d5
NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)