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

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
LVL 1
ilikenineAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ecwConnect With a Mentor Commented:
limitations of sed, positional replacement only understands a single digiti after the \
0
 
ahoffmannCommented:
as ecw said.

and your command also might not work, 'cause .* is greedy.
I suggest:
     awk -F, '{print $10}' file
0
 
ecwCommented:
good point, even if it could print \10, that'd be nul
0
 
ilikenineAuthor Commented:
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
 
ahoffmannCommented:
> It is not that greedy.
Hmm, may depend on sed version: AT&T vs. GNU
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.