hi i actually tried to manage an awk script that fiddles with the a text file that has contents like follows
. [135]Edwards Engineering Pty Ltd
Quality Structural Steel. Specialising In Fabrication And Steel
Stairs
21- 23 Ada Ave, Brookvale NSW 2100
ph: (02) 9938 5320
. [269]Diavolo Steel Fabrication
5 Humeside Drv, Campbellfield VIC 3061
ph: (03) 9357 7947
. [40]WH Williams Pty Ltd
Your Partner For High Quality Custom-Made Metal Products
Short lead times & unbeatable quality. Make us the first choice for
your entire sheetmetal laser cutting,bending,welding & more.
61- 77 Egerton St, Silverwater NSW 2128
ph: (02) 9647 1277
[41]www.whwilliams.com.au
and so on.. a huge file actually.. and the script i managed to write is
awk '$2 ~ /\. \[/{$1=x; print}' RS=\* FS='\n' OFS='|' Myfile > excel.csv
this command converts my text file into a csv file with record separation.. but as you can see above, the lengths of addresses in the above mentioned example are varying and i am getting a csv file with irregular formatting..
so what i want to do now is change the command to put the 1.title of the company in one cell, 2.the description part , if exists in one cell and if doesnt exist, the cell to be left empty, 3. the address part in one cell, 4. the phone num in one cell 5.the website in one cell.. and if any particular component doesnt exist, that cell should be left empty..
i am new to linux and trying to handle stuff and pretty new to shell and awk too.. so can any one help me out if it is possibility to do so...