10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am trying to print multiple patterns in a line using sed. But it is printing only the last occurance of a pattern.
If the line is
the the output should be
Lookup Procedure|Stored proc
But the output I am getting is
Stored proc
The code I am using is
echo... (9 Replies)
Discussion started by: kedar_laveti
9 Replies
2. Shell Programming and Scripting
my requirement is,
consider a file output
cat output
blah sdjfhjkd jsdfhjksdh
sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf
hellow there
this doesnt look good
et cetc etc
etcetera
i want to replace a line of line number 4 ("this doesnt look good") with some other line
... (3 Replies)
Discussion started by: vivek d r
3 Replies
3. Shell Programming and Scripting
Hi All
I'm trying to extract the line just above a regexp and all lines after this.
I'm currently doing this in two steps
sed -n -e "/^+---/{g;p;}" -e h oldfile.txt > modified.txt
sed -e "1,/^+---/d" -e "/^$/d" oldfile.txt >>modified.txt
Sample
sometext will be here
sometext will be... (3 Replies)
Discussion started by: Celvin VK
3 Replies
4. Shell Programming and Scripting
I am completely new to shell scripting but have been assigned the task of creating several batch files to manipulate data. My final task requires me to find lines that have duplicates present then delete not only the duplicate but the original as well. The script will be used in a windows... (9 Replies)
Discussion started by: chino_1
9 Replies
5. Shell Programming and Scripting
Hi,
I want to print the line number with the pattern of the line on a same line using multi-patterns in sed.
But i don't know how to do it.
For example, I have a file
abc
def
ghi
I want to print
1 abc
2 def
3 ghi
I know how to write it one line code, but i don't know how to put... (11 Replies)
Discussion started by: ntpntp
11 Replies
6. Shell Programming and Scripting
Hi,
This is more a theoretical question, because I usually solved that with perl or even java, but I would like to know if it exists an easy way to do it with SED.
Using regular expresions it's very easy to select an portion line. Does it exist an easy way for printing those portions in SED?... (1 Reply)
Discussion started by: islegmar
1 Replies
7. UNIX for Dummies Questions & Answers
I'm using the sed command to pull a line from a file and place it into another file:
sed -n '1p' students >tmp
this pulls the first line, I want to change the 1 to a variable which will be a counter to go through the rest of the lines but can't get it. I've tried:
sed -n '$cp students... (3 Replies)
Discussion started by: atchleykl
3 Replies
8. Shell Programming and Scripting
hello,
i have a file "TEST" and want to change the digit(s) after "=" . but i also want to print the old entry with a comment (for information).
i want to use "sed", is it possible ?
file:
TEST = 10 # comment default value: 0
sed , with "p" , i can print the old entry, but i want to... (2 Replies)
Discussion started by: bora99
2 Replies
9. Shell Programming and Scripting
I am trying to use wget and sed to extract a text based weather forecast for the Greater Victoria area only, this is one paragraph of many in a web page. I have tried /^$/ but that does not seem to work. So far I get mostly what I want with this:
wget -qO -... (2 Replies)
Discussion started by: lagagnon
2 Replies
10. Shell Programming and Scripting
Hi,
Need awk help to group and print lines to format the output as shown below
INPUT FORMAT
set echo on
set heading on
set spool on
/* SCHEMA1 */ CREATE TABLE T1;
/* SCHEMA1 */ CREATE TABLE T2;
/* SCHEMA1 */ CREATE TABLE T3;
/* SCHEMA1 */ CREATE TABLE T4;
/* SCHEMA1 */ CREATE TABLE T5;... (5 Replies)
Discussion started by: rajan_san
5 Replies