Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-01-2014, 07:39 PM   #1
LQ Newbie
Registered: Mar 2014
Posts: 26

Rep: Reputation: Disabled
Question about sed

Below is the output from my LPIC book I am stuck because I dont understand what the Addresses mean in this Table 1.4. Can anyone explain what they mean by 0 or 1?

"The sed command directly modifies the contents of files, sending the changed file to standard output. Its syntax can take one of two forms:

sed [options] -f script-file [input-file]
sed [options] script-text [input-file]

In either case, input-file is the name of the file you want to modify. (Modifications are temporary unless you save them in some way, as illustrated shortly.) The script (script-text or the contents of script-file) is the set of commands you want sed to perform. When you pass a script directly on the command line, the script-text is typically enclosed in single quote marks. Table 1.4 summarizes a few sed commands that you can use in its scripts.

TABLE 1.4 Common sed commands
Command Addresses Meaning
= * 0 or 1 Display the current line number.
a\text * 0 or 1 Append text to the file.
i\text * 0 or 1 Insert text into the file.
r filename * 0 or 1 Append text from filename into the file.
c\text * Range Replace the selected range of lines with the provided text.
s/regexp/repl * Range Replace text that matches the regular expression (regexp) with replacement.
w filename * Range Write the current pattern space to the specified file.
q * 0 or 1 Immediately quit the script, but print the current pattern space.
Q * 0 or 1 Immediately quit the script.

Last edited by HWDPlinux; 04-01-2014 at 07:42 PM.
Old 04-02-2014, 04:01 AM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.3
Posts: 17,537

Rep: Reputation: 2420Reputation: 2420Reputation: 2420Reputation: 2420Reputation: 2420Reputation: 2420Reputation: 2420Reputation: 2420Reputation: 2420Reputation: 2420Reputation: 2420
I have to say it looks like nonsense to me, but I'm sure it makes sense to a sed guru.
Try this


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] head -n -1 (sed -n -e '1,$-1p' is incorrect) sed question, as stupid as it could be. kaz2100 Programming 1 12-27-2011 09:18 PM
Question regarding sed. mrmnemo Programming 5 09-07-2011 03:56 PM
Sed question wondergirl Programming 21 02-22-2008 02:42 AM
[sed] "Advanced" sed question(s) G00fy Programming 2 03-20-2006 12:34 AM
question on sed tifu Linux - Newbie 3 03-18-2005 04:38 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:25 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration