Page 1 of 1

How to put my input record in single quotes?

PostPosted: Thu Mar 29, 2012 7:59 pm
by skankatala
I have a list of PS file names in another PS file.

Sample Input file
record1   
record2   
record3   


My output file should be

'record1'
'record2'
'record3'


Note: record lengths are variables.

Record1 has 40 bytes.
Record2 has 42 bytes.
Record3 has 38 bytes.

I need the single quote before first character of the record and after last character of the record.

Please suggest me...

Re: How to put my input record in single quotes?

PostPosted: Thu Mar 29, 2012 8:08 pm
by BillyBoyo
Have a look at STRING in the Language Reference. While there, it is always worth looking around, so at least take in UNSTRING and INSPECT at the same time.

Re: How to put my input record in single quotes?

PostPosted: Fri Mar 30, 2012 6:21 pm
by Ed Goodman
Something to watch out for: Does your data have ANY CHANCE to have single quotes in it already? Maybe an Irish name, or an Arabic name? The wheels will come off your wagon pretty quickly if that can happen.

Re: How to put my input record in single quotes?

PostPosted: Fri Mar 30, 2012 6:28 pm
by skankatala
Ed Goodman wrote:Something to watch out for: Does your data have ANY CHANCE to have single quotes in it already? Maybe an Irish name, or an Arabic name? The wheels will come off your wagon pretty quickly if that can happen.


Nope, my data doesn't contain any quotes or special characters.

Thanks for your help.