Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-09-2012
Registered User
 
Join Date: Feb 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
SED Command

(sed '' file1 | sort -o file2)


what is (sed '' file1) means?
Sponsored Links
    #2  
Old 07-09-2012
Scrutinizer's Avatar
Moderator
 
Join Date: Nov 2008
Location: Amsterdam
Posts: 7,353
Thanks: 144
Thanked 1,756 Times in 1,593 Posts

Code:
cat file1

--
It could all be replaced by:

Code:
sort file1 > file2

Sponsored Links
    #3  
Old 07-09-2012
Registered User
 
Join Date: Feb 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for the response. What exactly single quotes meaning in below command?

sed '' file1
    #4  
Old 07-09-2012
alister alister is offline Forum Advisor  
Registered User
 
Join Date: Dec 2009
Posts: 2,607
Thanks: 123
Thanked 719 Times in 602 Posts
They mean what they always mean in a sh script. It's an empty string. sed never sees those quotes, but it is passed an empty string as its first argument. sed interprets this as an empty list of commands. Given no commands, and without the -n option, sed just prints each line it reads. In other words, as Scrutinizer mentioned, it behaves like cat.

Regards,
Alister
Sponsored Links
Closed Thread

Tags
sed command with single quotes

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
When i am trying to execute export command within a shell script it is saying command not found. dchoudhury Shell Programming and Scripting 4 06-18-2012 01:13 AM
passing command output from one command to the next command in cshell kaaliakahn UNIX for Dummies Questions & Answers 2 02-10-2012 04:59 PM
unix command : how to insert text at the cursor location via command line? xib.be UNIX for Advanced & Expert Users 0 12-22-2010 05:45 PM
Need help! command working ok when executed in command line, but fails when run inside a script! 4dirk1 Shell Programming and Scripting 4 12-02-2010 05:47 AM
awk/sed Command : Parse parameter file / send the lines to the ksh export command rajan_san Shell Programming and Scripting 4 11-06-2008 12:29 PM



All times are GMT -4. The time now is 06:28 PM.