regex - Awk/ Perl regular expression to match space with hyphen -


i have following 2 lines in sample.txt

aia - 1000 aia integrations e-business suite - 5544 

now want see following output:

column1                                         | column2 aia                                               1000 aia integrations e-business suite             5544 

i tried:

awk -f "-" sample.txt 

it filters hyphen "-" near "e-business suite" how make filter last hyphen instead of intermediate ones.

you can use:

awk -f ' - ' -v ofs=';' 'begin{print "column1", "column2"} {print $1, $2}' file | column -s ';' -t  column1                                column2 aia                                    1000 aia integrations e-business suite  5544 
  • -f ' - ' uses " - " input field separator
  • -v ofs=';' uses ; output field separator
  • column -s ';' -t formats data in tabular format using ; delimiter

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -