Replace Pioneer Home
All Examples
Free Download
all
Advanced search and replace
Replace text in multiple files
Regular expression replace
Batch file rename
Batch download
Text file parser
Text file splitter
Html text generator
Search replace binary
Random word generator
Count and statistics
Character encoding
Bin Hex Oct Dec converter
Text generator
Text sort
Text merge
Text data calculation
RSS: Replace Pioneer Examples
238.Advanced search and replace -- How to add spaces to align text to the center in a text file?
User:
editor -- 2008-07-30
<< 237
239 >>
Hits:
3405
Type:
Advanced search and replace
Search all
Advanced search and replace
examples
Description:
How to add some spaces at the beginning of each line to align the text to the center in a pure text file.
Input Sample:
aaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbb
ccccc
Output Sample:
aaaaaaaaaaaaaaaaaaaaaa
<---->bbbbbbbbbbbb
<-spaces->ccccc
Answer:
Hint: You need to
Download and install "Replace Pioneer"
on windows platform to finish following steps.
Assuming max line lenth is 40, so we need to add 40/2-length/2 number of spaces at begin.
1. ctrl-o open source text file
2. ctrl-h open 'Replace' dialog.
* set "Replace Unit" to "Line"
* set "Search for pattern" to:
.*
* set "Replace with pattern" to:
' 'x(40/2-length($match)/2).$match."\n"
3. Click "Replace", done!
Download Script:
scripts/238.rst.zip
Screenshot 1: Replace_Window
Similar Examples:
How to add a single space after each character in a text file?
(69%)
How to add specified text to the begin and end of many text files?
(68%)
How to sort the numbers in each line by the descending order in a text file?
(63%)
How to reverse all cases of letters in a text file?
(62%)
How to replace the content of XML with a list of words from text file?
(61%)
How to batch replace the last 5 "old" with "new" in a text file?
(61%)
How to add 3 spaces after every 9 characters in a text file?
(61%)
How to replace a word with a list of words repeatly in a text file?
(60%)
Check Demo of
Advanced search and replace
Keywords:
align
add spaces
length
add space
nth
max
spaces
space
at the beginning
beginning
spaces align
add spaces text file
add spaces in a text file
add to beginning
add text beginning
add a number each line
add line number
beginning of line