Re: [uug] sed question

2007-04-16 Thread Byron Clark
On Mon, Apr 16, 2007 at 04:36:51PM -0600, Eduardo Sanz Garcia wrote: > Chris Carey wrote: > > On 4/16/07, Eduardo Sanz Garcia <[EMAIL PROTECTED]> wrote: > > > I have a file like this: > > > [arbitrary number of spaces]/37/[arbitrary number of > > > spaces]/100/[arbitrary number of spaces]/95/ > > >

Re: [uug] sed question

2007-04-16 Thread Eduardo Sanz Garcia
Thank you very much. The sed command works great. The -i option is also great, thank you for the suggestions. Lloyd Brown wrote: >Try this: > >sed -e 's/ \+/\t/g' > >Now, normally, I'd use a "\s" to represent any form of whitespace, but for >some reason, this wasn't working for me, so I just use

Re: [uug] sed question

2007-04-16 Thread Lloyd Brown
Try this: sed -e 's/ \+/\t/g' Now, normally, I'd use a "\s" to represent any form of whitespace, but for some reason, this wasn't working for me, so I just used a single space. Honestly, I *really* like regexes, but I use them either in a language like Perl, or in an editor most often. Sed isn

Re: [uug] sed question

2007-04-16 Thread Alberto Treviño
On Monday 16 April 2007 04:07:50 pm Eduardo Sanz Garcia wrote: > I have a file like this: > [arbitrary number of spaces]/37/[arbitrary number of > spaces]/100/[arbitrary number of spaces]/95/ > > I want to convert each arbitrary number of spaces into one tab: > [tab]/37/[tab]/100/[tab]/95/ > > How

Re: [uug] sed question

2007-04-16 Thread Eduardo Sanz Garcia
Could you give an example? Chris Carey wrote: >On 4/16/07, Eduardo Sanz Garcia <[EMAIL PROTECTED]> wrote: > > >>I have a file like this: >>[arbitrary number of spaces]/37/[arbitrary number of >>spaces]/100/[arbitrary number of spaces]/95/ >> >>I want to convert each arbitrary number of spaces i

Re: [uug] sed question

2007-04-16 Thread Chris Carey
On 4/16/07, Eduardo Sanz Garcia <[EMAIL PROTECTED]> wrote: > I have a file like this: > [arbitrary number of spaces]/37/[arbitrary number of > spaces]/100/[arbitrary number of spaces]/95/ > > I want to convert each arbitrary number of spaces into one tab: > [tab]/37/[tab]/100/[tab]/95/ > > How can

[uug] sed question

2007-04-16 Thread Eduardo Sanz Garcia
I have a file like this: [arbitrary number of spaces]/37/[arbitrary number of spaces]/100/[arbitrary number of spaces]/95/ I want to convert each arbitrary number of spaces into one tab: [tab]/37/[tab]/100/[tab]/95/ How can I do this with sed? Thank you. BYU Unix Users Group

Re: [uug] sed question

2007-03-12 Thread Michael Brailsford
Users Group Sent: Monday, March 12, 2007 8:03:35 PM Subject: Re: [uug] sed question I found the reply to my own question: echo "akd_fak_asdkf_jal" | sed -e "s/\(_.*\)//" ===> akd Eduardo Sanz Garcia wrote: >Now the *oposite* question: >If I have a line like this &q

Re: [uug] sed question

2007-03-12 Thread Eduardo Sanz Garcia
I found the reply to my own question: echo "akd_fak_asdkf_jal" | sed -e "s/\(_.*\)//" ===> akd Eduardo Sanz Garcia wrote: >Now the *oposite* question: >If I have a line like this "akd_fak_asdkf_jal" and I want the leading "akd" >How can I do this using sed or other utilities? > > >Eduardo Sa

Re: [uug] sed question

2007-03-12 Thread Eduardo Sanz Garcia
Now the *oposite* question: If I have a line like this "akd_fak_asdkf_jal" and I want the leading "akd" How can I do this using sed or other utilities? Eduardo Sanz García wrote: >A sed question: >I have a line like this "akd_fak_asdkf_jal" and I want the trailing >"_jal". >How can I do this u

Re: [uug] sed question

2007-03-12 Thread Michael Brailsford
IL PROTECTED]> To: uug-list@uug.byu.edu; uug-list@phantom.byu.edu Sent: Saturday, March 10, 2007 6:24:35 PM Subject: Re: [uug] sed question * Michael Brailsford [Sat, 10 Mar 2007 at 11:25 -0800] > I would use awk (or any of its various forms, such as gawk) for that. > > echo akd_fak_asdkf

Re: [uug] sed question

2007-03-10 Thread Von Fugal
Blasted! Why does that always happen to me? signature.asc Description: Digital signature BYU Unix Users Group http://uug.byu.edu/ The opinions expressed in this message are the responsibility of their author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG.

Re: [uug] sed question

2007-03-10 Thread Von Fugal
* Michael Brailsford [Sat, 10 Mar 2007 at 11:25 -0800] > I would use awk (or any of its various forms, such as gawk) for that. > > echo akd_fak_asdkf_jal | gawk -F_ '{print "_" $4}' > > Or even cut (though you will lose the char used as the delim): > > echo akd_fak_asdkf_jal | cut -f4 -d_ What

Re: [uug] sed question

2007-03-10 Thread Michael Brailsford
ia <[EMAIL PROTECTED]> To: BYU Unix Users Group Sent: Friday, March 9, 2007 6:54:06 PM Subject: Re: [uug] sed question Thank you Joshua. It works well. The command was not simple. It seems that you know a lot about regular expression. How did you learn regular expression and/

Re: [uug] sed question

2007-03-09 Thread Joshua Draper
The way I learned was by finding a tutorial on-line and then practicing to get the feel of it. Joshua Draper On Mar 9, 2007, at 5:54 PM, Eduardo Sanz-Garcia wrote: > >Thank you Joshua. >It works well. >The command was not simple. It seems that you know a lot about > regular >

Re: [uug] sed question

2007-03-09 Thread Topher Fischer
Eduardo Sanz-Garcia wrote: >Thank you Joshua. >It works well. >The command was not simple. It seems that you know a lot about regular >expression. >How did you learn regular expression and/or sed? Any suggested book? > > O'Reilly has a book called, Mastering Regular Expressio

Re: [uug] sed question

2007-03-09 Thread Eduardo Sanz-Garcia
Thank you Joshua. It works well. The command was not simple. It seems that you know a lot about regular expression. How did you learn regular expression and/or sed? Any suggested book? Joshua Draper wrote: If you know want the text "_jal", you can use line below. I saved your

Re: [uug] sed question

2007-03-09 Thread Joshua Draper
If you know want the text "_jal", you can use line below. I saved your text string in a file called testsed. $ sed -e "s/.*\(_jal\)/\1/" testsed If you want the "_jal" because it is the last group of letters, then you could use the following line. $ sed -e "s/.*\(_.*\)/\1/" testsed both co

[uug] sed question

2007-03-09 Thread Eduardo Sanz García
A sed question: I have a line like this "akd_fak_asdkf_jal" and I want the trailing "_jal". How can I do this using sed or other utilities? Thank you. BYU Unix Users Group http://uug.byu.edu/ The opinions expressed in this message are the responsibility of their author.

Re: [uug] sed question

2003-12-16 Thread Byron Clark
On Tue, Dec 16, 2003 at 07:54:59PM -0700, Tony Vance wrote: > > Hey everyone, > > I have a sed question. I want to add more specific user information to the > /etc/passwd file using a shell script. I'm thinking of something like the following > to edit /etc/passwd's last line: > > echo Plea

[uug] sed question

2003-12-16 Thread Tony Vance
Hey everyone, I have a sed question. I want to add more specific user information to the /etc/passwd file using a shell script. I'm thinking of something like the following to edit /etc/passwd's last line: echo Please enter the user's full name: read fullname sed -i '$s/::/:$fullname:/' /et