The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl: Getting back reference from s modifier cooldude Shell Programming and Scripting 8 03-19-2008 06:49 AM
What does this I/O error mean and how to mount it back duke0001 UNIX for Advanced & Expert Users 5 03-19-2007 07:59 AM
C++ Compiling error.. Symbol Reference bjena UNIX for Advanced & Expert Users 3 08-08-2006 11:10 PM
back-up drive : tape error yackim SCO 3 03-03-2006 06:19 AM
Undefined reference to Error svh High Level Programming 2 02-10-2006 09:23 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-22-2006
Registered User
 

Join Date: Aug 2006
Posts: 69
back reference error

Hi,

i am getting this error........

find ./ | sed '/\([a-z]*\) \([a-z]*\)/\2\1/'
Unrecognized command: /\([a-z]*\) \([a-z]*\)/\2\1/


Any idea???

regards
Apoorva Kumar
Reply With Quote
Forum Sponsor
  #2  
Old 08-22-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
Yes, you aren't telling sed what command to execute! The regex is fine (haven't looked into the details), but sed needs to know what to do with the match if/when it finds it. i.e. If you want to just print the matching patterns, you still have to tell it to print them using the 'p' command.

Last edited by blowtorch; 08-22-2006 at 03:32 AM.
Reply With Quote
  #3  
Old 08-22-2006
Registered User
 

Join Date: Aug 2006
Posts: 69
thanks partner!!..I just missed to put a s there.

I have few file in my dir.....

abc 123
efg 567

I am trying this command.....

for file in `find ./|sed 's/^/\"/'|sed 's/$/\"/'`
do
echo $file
done

This is the output i am getting.........

"./"
"./.sh_history"
"./3rdPartytesting"
"./abc
123"
""
"./efg
456"
"./bkup"


The issue is there is an extra \n in the names of files which contains a space in them. Can you help me get a output like...

"./"
"./.sh_history"
"./3rdPartytesting"
"./abc 123"
""
"./efg 456"
"./bkup"

regards
Apoorva Kumar
Reply With Quote
  #4  
Old 08-22-2006
Registered User
 

Join Date: Aug 2006
Posts: 69
Quote:
Originally Posted by apoorvasharma80
thanks partner!!..I just missed to put a s there.

I have few file in my dir.....

abc 123
efg 567

I am trying this command.....

for file in `find ./|sed 's/^/\"/'|sed 's/$/\"/'`
do
echo $file
done

This is the output i am getting.........

"./"
"./.sh_history"
"./3rdPartytesting"
"./abc
123"
""
"./efg
456"
"./bkup"


The issue is there is an extra \n in the names of files which contains a space in them. Can you help me get a output like...

"./"
"./.sh_history"
"./3rdPartytesting"
"./abc 123"
""
"./efg 456"
"./bkup"

regards
Apoorva Kumar

Please any anwers??

regards
Apoorva Kumar
Reply With Quote
  #5  
Old 08-22-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,016
Pls don't bump-up posts if not answered immediately!
Code:
find . | sed 's/.*/"&"/'

Last edited by vgersh99; 08-22-2006 at 07:39 AM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0