Solved

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

Posted on 2002-05-15
5
462 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
Comment Utility
limitations of sed, positional replacement only understands a single digiti after the \
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
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
Comment Utility
good point, even if it could print \10, that'd be nul
0
 
LVL 1

Author Comment

by:ilikenine
Comment Utility
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
Comment Utility
> It is not that greedy.
Hmm, may depend on sed version: AT&T vs. GNU
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

13 Experts available now in Live!

Get 1:1 Help Now