I am a complete novice to scripting and for that matter grep so I am throwing myself at the mercy of this bulletin board.
My problem seems, or should I say seems to me, to fall into the category of easy-if you know how.
My problem is I don’t know how and am looking for help.
I will try to describe my problem as clearly as I can.
I am in the process of trying to tidy up some text, a hell of a lot of it or I would do it manually, but before I can get anywhere with the routine stuff (stripping multiple spaces and feeds etc) I have an obstacle to overcome.
The text I have to clean is destined for database fields and before I can go anywhere with it I need each record to only occupy one line and one line only. At present it is spread over two lines, The first line is the address and the second is a phone number. On the plus side at least the problem is a pretty consistent one, on the downside until I resolve it I can’t even get started.
To illustrate I will provide a tiny sample from one of the many text files I have to clean exactly as it looks now, complete with extra spaces etc (they are not the problem though):
Beechness Nursing Home Rathvensdale Leighlintown
(057) 9733366
Morris Lawns Nursing Home Morris Co Carlow
(058) 9963112
Hillview Convalescence & Nursing Home Boyle rd, Meath
(059) 8239507
Moyvale Nursing Home Ballon
(067) 5859299
St Patrick’s Lakeside Home Mucross
(021) 6151986
Many of the files that require work differ in obvious ways to this one but the one consistent element which, I think, would enable a script or grep pattern to work perfectly on all of them is the fact that the start of the second line will always contain a short series of numbers (not always limited to 3, some will be 2 and some will be more than 3) in brackets. What I need to do is to tell a text editor something like this: "find all lines starting with a bracket set (is that the right term?) containing numbers, precede them with a back space and insert a tab. The Tab insertion is actually very important as without it I will have another problem to replace my old one.
I have, no doubt used more words to describe this problem than is needed, if you took the trouble to read to the end, thanks. If you can help me at all, even more thanks.
Thanks
P.S. I only really posted this here out of desperation. My head is spinning from grep tutorials and the more I try to get anywhere the further away I get. I am not a coder or scripter but I know enought to realise that I need help from this area.