Linux/Unix Commands





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
LINUX / UNIX cmd
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Introduction
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in A
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in B
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in C
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in D
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in E
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in F
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in G
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in H
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in I
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in J
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in K
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in L
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in M
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in N
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in P
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in R
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in S
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in T
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in U
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in W
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Commands in Y
Forums Ask your doubts
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example More about Linux
LINUX/UNIX Commands tutorial/reference - Find linux cmd, syntax, example Feedback
 





sed Linux Commands


Tutorials Linux-commands

Topic

What is Linux sed Command?



Explanation

sed COMMAND:
     sed is a stream editor. sed command helps to edit or delete all occurrences of one string to another within a file. It takes a file as input and prints the result on screen or redirects the output to a specified file.

SYNTAX:
  The Syntax is
     sed [options] '{command}' [filename]

OPTIONS:
      Command and its function
-n do not output the trailing newline
-e enable interpretation of the backslash-escaped characters listed below
-E disable interpretation of those sequences in STRINGs

    Without -E, the following sequences are recognized and interpolated:
\NNN the character whose ASCII code is NNN (octal)
\a alert (BEL)
\b backspace
\c suppress trailing newline
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab



EXAMPLE:
     Lets assume that we have a file file1.txt and it has the following data.
hscripts has many valuable free scripts
It is the parent site of www.forums.hscripts.com
hscripts include free tutorials and free gif images
free DNS lookup tool
Purchase scripts from us
A webmaster/web master resource website
  1. sed G file1.txt>file2.txt
    

    In the above example, using the sed command with G would double space the file file1.txt and output the results to the file2.txt.

  2. sed = file1.txt | sed 'N;s/\n/\. /'

    In the above example, sed command is used to output each of the lines in file1.txt with the line number followed by a period and a space before each line.

  3. sed 's/scripts/javascript/g' file1.txt 
    Opens the file file1.txt and searches for the word 'scripts' and replaces every occurrence with the word 'javascript'.
  4. sed -n '$=' file1.txt
    The above command count the number of lines in the file1.txt and output the results.




A Note

Find LINUX Commands... Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this LINUX / UNIX cmd reference. This is a copyright content.


Other Links

web hosting

 

Free Hosting

Top Hosting Companies