[ale] regex assistance

Ed Cashin ecashin at noserose.net
Thu Jan 23 17:08:26 EST 2014


Using tr without UUoC would be better in theory than my favorite, but
I like sed.  ;)

On Thu, Jan 23, 2014 at 5:07 PM, Ed Cashin <ecashin at noserose.net> wrote:
> If variety is a virtue, I'll share my favorite:
>
>   xargs < myfile | sed 's! !|!g'
>
> ... where myfile contains the input.
>
>
> On Thu, Jan 23, 2014 at 4:18 PM, Horkan Smith <ale at horkan.net> wrote:
>> One more for variety...
>>
>> cat textfilename | ( read line; echo -n $line; while read line
>>  do
>>   echo -n ' | ' $line
>>  done
>> echo)
>>
>> As written it will echo at least one blank line even if your input file is empty.
>>
>> There's a good chance this would be the slowest of the choices, but if the file's not multi-megabyte I don't think it's going to matter.
>>
>> later!
>>    horkan
>>
>> On Thu, Jan 23, 2014 at 01:09:17PM -0500, brock at quantifier.org wrote:
>>>
>>> Hello, linux neighbors,
>>>
>>> I am a regular expression amateur.  I have a text file with a bunch
>>> of numbers, which looks like this:
>>>
>>> 00
>>> 01
>>> 02
>>> 03
>>> 04
>>>
>>> and I need to convert it, so that each number is on one line, and
>>> separated with the | pipe, so:
>>>
>>> 00 | 01 | 02 | 03 | 04
>>>
>>> If it's not too much trouble, could someone script-fu something up
>>> to solve my problem?
>>>
>>> Thanks much,
>>> Robert
>>> _______________________________________________
>>> Ale mailing list
>>> Ale at ale.org
>>> http://mail.ale.org/mailman/listinfo/ale
>>> See JOBS, ANNOUNCE and SCHOOLS lists at
>>> http://mail.ale.org/mailman/listinfo
>>
>> --
>> Horkan Smith
>> 678-777-3263 cell, ale at horkan.net
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>
>
>
> --
>   Ed Cashin <ecashin at noserose.net>
>   http://noserose.net/e/
>   http://www.coraid.com/



-- 
  Ed Cashin <ecashin at noserose.net>
  http://noserose.net/e/
  http://www.coraid.com/


More information about the Ale mailing list