I have lines like the ones shown below.
abcbasndo
bacmaisca
ascmasoc
Now, I need to take out the first three characters of every line and add AAA at the start and end of each line, so that it looks like the one shown below.
AAAabcAAA
AAAbacAAA
AAAascAAA
I am using windows.
Please help.
This little
cmdscript will do the job for you:See the following transcript:
The
forloop grabs each line in theqq.txtfile (withoutdelims=, it would use spaces within the line as delimiters) and puts it in%%a.The body of the
forloop puts that value intovarand then uses the substring operator to get the first three characters.I haven’t tested what will happen if the line has less than three characters since (1) you didn’t specify what you expected; and (2) it should be fairly easy to expand this script to handle it.