The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 09: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 10:59 AM
C++ Compiling error.. Symbol Reference bjena UNIX for Advanced & Expert Users 3 08-09-2006 02:10 AM
back-up drive : tape error yackim SCO 3 03-03-2006 09:19 AM
Undefined reference to Error svh High Level Programming 2 02-11-2006 12:23 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-22-2006
apoorvasharma80 apoorvasharma80 is offline
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
  #2 (permalink)  
Old 08-22-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
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 06:32 AM..
  #3 (permalink)  
Old 08-22-2006
apoorvasharma80 apoorvasharma80 is offline
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
  #4 (permalink)  
Old 08-22-2006
apoorvasharma80 apoorvasharma80 is offline
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
  #5 (permalink)  
Old 08-22-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

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

Last edited by vgersh99; 08-22-2006 at 10:39 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0