All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
How to insert new paragraph/text after x paragraph ?
I have hundreds of .txt files in one directory. Each files contain around 9-15 paragraph.
I need to insert 3 new paragraph in all files, that each new paragraph location random after x paragraph, and 1 footer notes. And save all as separated new files in new directory. For example if 1 files contain 9 paragraph so the result will be
P1
P2
NP1
P3
NP2
P4
P5
P6
P7
NP3
P8
P9
FooterNotes
Or
P1
NP1
NP2
P2
P3
P4
P5
P6
NP3
P7
P8
P9
FooterNotes
P = Paragraph,
NP = New paragraph,
NP1-3 is constant like address, list of phone numbers etc.
So NP1 NP2 NP3 random after x paragraph in each files, but FooterNotes always in bottom.
Please if anyone can help me. Maybe this can be done with bash / awk ? will accept any solutions. Thanks in advance.
Comments
show what you have done so far
i'm not programmer at all so i'm asked it. Already browse in stackoverflow/superuser but can't find solution.
flagged
can't help you there, sorry!
I'd recommend to remove his link from comment just so he don't receive any seo juice
uhmm... for a linux machine maibe sed can help if you have some mark on text to find:
for file in $(ls -1 /dir); do sed -i s/text2find/text2findplusnew/g $file; done
That ^, look for the footer info and prepend
You could use additional
sed
for footer info to add a line break and footer info at bottom of each text + search and add for specific text, regex for inbetween paragraph