02-14-2013
Quote:
Originally Posted by
edstevens
Can you explain why the change from single- to double-quote to enclose the sed commands?
Since you are using the variable:
${fline} inside
sed you have to use double-quotes to expand this variable.
Single-quotes prevents variable expansion.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
sed "/$titlesearch/d" movielist
will delete any line in the file movielist that matches $titlesearch, but this is only a screen print correct ?
how can I have sed to actually delete the line from the file so that it doesnt appear next time I open the file ?
thanks
Steffen (8 Replies)
Discussion started by: forever_49ers
8 Replies
2. Shell Programming and Scripting
Hello Experts,
I am working on a small file editing script. Since all experts here are very generous to give me the complete code, I would take up the problem in steps so that I ensure my opportunity to learn.
AIM: The script has some commented and some uncommented lines. I need to :
... (2 Replies)
Discussion started by: hkansal
2 Replies
3. Shell Programming and Scripting
I'm new to using sed and grep commands, but have found them extremely useful. However I am having a hard time figuring this one out:
Delete every line containing the word CEN and the next line as well.
ie. test.txt
blue
324 CEN
green
red
blue
324 CEN
green
red
blue
to produce:... (2 Replies)
Discussion started by: rocketman88
2 Replies
4. Shell Programming and Scripting
awk '!(/^$/||/--/||/selected/||/^ *$/){print "A." $1 " <> B." $1 " or"}' infile
my AWK out put is :
A.KZ <> B.KZ or
A.KZT <> B.KZT or
A.KZ_Z <> B.KZ_Z or
A.LH <> B.LH or
A.MAN<> B.MAN or
A.OBJEKT <> B.OBJECT or
A.PAK <> B.PAK ;
is there any way to controle AWK to not print the... (1 Reply)
Discussion started by: kanakaraju
1 Replies
5. Shell Programming and Scripting
I want to delete a line between selected lines using sed:
e.g. : Between "bus" to "pins", delete lines conaining "signal" word.
Input :
bus
direction
signal new
signal old
pins
signal ok
end
Desired Output:
bus
direction
pins
signal
end (4 Replies)
Discussion started by: nehashine
4 Replies
6. Shell Programming and Scripting
Hello,
I want to delete all lines with given string in file1 and the string val is dynamic.
Can this be done using sed command.
Sample:
vars="test twinning yellow"
for i in $vars
do
grep $i file1
if
then
echo "Do Nothing"
else
sed `/$i/d` file1
fi
done
Using the above... (5 Replies)
Discussion started by: PrasadAruna
5 Replies
7. UNIX for Dummies Questions & Answers
Hello,
:wall:
I have a 12 column csv file. I wish to delete the entire line if column 7 = hello and column 12 = goodbye. I have tried everything that I can find in all of my ref books.
I know this does not work
/^*,*,*,*,*,*,"hello",*,*,*,*,"goodbye"/d
Any ideas?
Thanks
Please... (2 Replies)
Discussion started by: Chris Eagleson
2 Replies
8. Shell Programming and Scripting
here is what i want to achieve.. i have a file with below contents
cat fileName
blah blah blah
.
.DROP this
REJECT that
.
--sport 7800 -j REJECT --reject-with icmp-port-unreachable
--dport 7800 -j REJECT --reject-with icmp-port-unreachable
.
.
.
more blah blah blah
--dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies
9. Shell Programming and Scripting
Below is the output of a DB2 command. Now I have 2 requirements...
Database Partition 0 -- Database TESTDB1 -- Active Standby -- Up 213 days 02:33:07 -- Date 02/22/2016 17:04:50
HADR Information:
Role State SyncMode HeartBeatsMissed LogGapRunAvg (bytes)
Standby ... (2 Replies)
Discussion started by: rlokesh27
2 Replies
10. Shell Programming and Scripting
hello Team,
I want to delete below linux using sed command but I am getting error.sed -i '/url=/status.cgi?hostgroup=/d' 3
error:sed: -e expression #1, char 32: unknown option to `s'
Could you please help me with correct syntax.
My line contain / character because of that I am getting... (4 Replies)
Discussion started by: ghpradeep
4 Replies
LEARN ABOUT OPENSOLARIS
winsdelln
insdelln(3XCURSES) X/Open Curses Library Functions insdelln(3XCURSES)
NAME
insdelln, winsdelln - insert/delete lines to/from the window
SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib
-R /usr/xpg4/lib -lcurses [ library... ]
c89 [ flag... ] file... -lcurses [ library... ]
#include <curses.h>
int insdelln(int n);
int winsdelln(WINDOW *win, int n);
PARAMETERS
n Is the number of lines to insert or delete (positive n inserts; negative n deletes).
win Is a pointer to the window in which to insert or delete a line.
DESCRIPTION
The insdelln() and winsdelln() functions insert or delete blank lines in stdscr or win, respectively. When n is positive, n lines are
added before the current line and the bottom n lines are lost; when n is negative, n lines are deleted starting with the current line,
the remaining lines are moved up, and the bottom n lines are cleared. The position of the cursor does not change.
RETURN VALUES
On success, these functions return OK. Otherwise, they return ERR.
ERRORS
None.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO
deleteln(3XCURSES), insertln(3XCURSES), libcurses(3XCURSES), attributes(5), standards(5)
SunOS 5.11 5 Jun 2002 insdelln(3XCURSES)