#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    1
    Rep Power
    0

    Question Formatting using AWK, SED, PERL


    Hey,

    I have a SQL statement as follows :

    select tab1.col1, tab2,col2,tab3.col3 from scott.emp where tab1.col1 = tab2.col2 and tab2.col2 = tab3.col3

    I need this statement to be formatted as follows :

    select
    tab1.col1,
    tab2,col2,
    tab3.col3
    from
    scott.emp
    where
    tab1.col1 = tab2.col2
    and
    tab2.col2 = tab3.col3 ;

    1) Tabs inserted for all columns and all keyword like select,from...
    2) New Lines after all columns
    3) A terminating semi-colon at the end of the etc etc...

    Which would be the easy route ? AWK, SED or PERL ?

    Thanx in advance !

    -Mike
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    68
    Rep Power
    11
    >Which would be the easy route ? AWK, SED or PERL ?
    There is never any contest, Perl is the way to go in every situation I've encountered. Hell, I've practically replaced my shell scripting needs with Perl scripts.

IMN logo majestic logo threadwatch logo seochat tools logo