[HPADM] RE: Text Processing Question

From: Geremy.E.Cohen@WellsFargo.COM
Date: Tue Sep 10 2002 - 11:25:18 EDT


Thanks to all who responded!

Here are some of the methods that were presented:

---------------

echo FOO | awk '{print "<"$1">"$1"<"$1">"}'

---------------

sed 's/\(.*\)/<\1>\1<\1>/' input > output

---------------

sed "s/\(RE\)/<\1>\1<\1>/"

---------------

echo foo | sed 's/foo/<&>&<&>/'

---------------

echo bar | sed 's/^.*$/<&>&<&>/'

---------------

cat file | awk '{print "<"$1">"$1"<"$1">"}'

---------------

echo "FOO" | sed -e 's/\(.*\)/<\1>\1<\1>/'

---------------

STRING=FOO;sed -e s/$STRING/\<$STRING\>$STRING\<$STRING\>/

---------------

perl -p -i -e "s/WORD/<WORD>WORD<WORD>/g;" file

---------------

geremy

> -----Original Message-----
> From: Geremy.E.Cohen@WellsFargo.COM
> [mailto:Geremy.E.Cohen@WellsFargo.COM]
> Sent: Friday, September 06, 2002 11:04 AM
> To: hpux-admin@DutchWorks.nl
> Subject: [HPADM] Text Processing Question
>
>
> Hello All-
>
> Given a line of text that a word, how could I use sed, awk,
> etc to convert:
>
> FOO
> to
> <FOO>FOO<FOO>
>
> ?
>
> Basically, given a pattern, I want to insert and append a
> string based on
> that pattern around it.
>
> I assume sed or awk can do this, but Im not sure how . . .
>
> tia,
> geremy
>
>
>
> --
> Geremy E. Cohen
> Wells Fargo Bank
> Information Security Analyst
> Security Production Services, ESM
> 155 Fifth Street, San Francisco, Ca. 94103
>
>
> --
> ---> Please post QUESTIONS and SUMMARIES only!! <---
> To subscribe/unsubscribe to this list, contact
> majordomo@dutchworks.nl
> Name: hpux-admin@dutchworks.nl Owner:
> owner-hpux-admin@dutchworks.nl
>
> Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin
> (FTP, browse only)
> http://www.dutchworks.nl/htbin/hpsysadmin (Web,
> browse & search)
>

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:19 EDT