[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Text Manipulation
Thanks for the 
assistance so far, it is helping some.
Let me expand a 
little on the requirements.  In this
particular 
instance, the first field will be, say,
18 characters 
long, followed by a space, then three fields,
say 8 characters 
long each followed by a space, and then a final field,
say 
5 
characters long.  A colleage of mine is attempting
to evangelize me 
with the shell commands "cut" and "paste".
I'm a little concerned with cutting out all the data 
into
separate files, 
and then pasting it all back together
into one 
file.  It seems too easy to offset the lines
somehow, or 
otherwise screw up the whole thing.
 
I'm kind of 
thinking of a PERL script that will take
the characters one 
at a time, and looping the appropriate
number of times 
for each field of characters, and inserting
the spaces between 
loops.
 
We have run across 
this problem before, but fortunately have
been able to brute 
force our way through it; or even more
fortunately, have 
been able to substitute because of repeated
characters.  
It just seems like this would be a fairly common
problem with a 
published solution, but we have not yet been
able to find 
it.
 
Thanks 
again,
 
Tyler
 
 
 
 
 
 
All,
 
I have racked my 
brains trying to figure out a way to insert
a column of white 
space in a plain text file several (tens of)
thousands 
lines 
long.  The problem is there is no common text
before or after 
the column I need to insert the blank space.
 
For example, take 
the following block of text:
 
12345ABCDE67890FGHJK
Q1W2E3R4T5Y6U7I8O9P0
MNBHGVFRT7352508HY7S
THISLINEHASNOBLANKS2
ANOTHERLINEWITHNONE5
1MORELINEWITHNONEZZZ
 
I would like to 
insert a column (or two) of white space to
essentially create 
fields to be manipulated with NAWK, so
that the above 
text would look like the following:
 
12345AB CDE67890F 
GHJK
Q1W2E3R 4T5Y6U7I8 
O9P0
MNBHGVF RT7352508 
HY7S
THISLIN EHASNOBLA 
NKS2
ANOTHER LINEWITHN 
ONE5
1MORELI NEWITHNON 
EZZZ
 
I can use PERL, if 
necessary, but have a preference for either a shell script or SED command, 
etc..
 
Any 
ideas?
Thanks in 
advance,
Tyler