Solved

sed 's/\(.*\)...........

Posted on 2002-05-15
5
463 Views
Last Modified: 2013-12-26
Hi
I am trying this
sed 's/\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\)/10' <file>

I am not able to get the \10 printed. It prints the \1 instead.

Is this the limitation of SED or of my system.
I am on Tandem OSS.

Or is there a way around to do what i am doing.
Yep i know i can do it with AWK and i am doint it that way.
But i want to do with SED.

Thanks
Ilikenine
0
Comment
Question by:ilikenine
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
ecw earned 50 total points
ID: 7011473
limitations of sed, positional replacement only understands a single digiti after the \
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7012059
as ecw said.

and your command also might not work, 'cause .* is greedy.
I suggest:
     awk -F, '{print $10}' file
0
 
LVL 5

Expert Comment

by:ecw
ID: 7012571
good point, even if it could print \10, that'd be nul
0
 
LVL 1

Author Comment

by:ilikenine
ID: 7013800
na but .* goes till the next comma(,) only . It is not that greedy.

so the awk i am using is
awk '{FS=","}{print $10}'

will give points to ECW.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7014521
> It is not that greedy.
Hmm, may depend on sed version: AT&T vs. GNU
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA "SendKeys" Syntax for Multiple Keystrokes 7 103
has22 challenge 11 78
only14 challenge 19 68
building a service to accessed via telnet client, want colors ? 4 80
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now