User: editor -- 2010-11-03 << 646 648 >> |
Hits: 2622 |
Type: Advanced search and replace |
Search all Advanced search and replace examples |
Description: |
How to format the CSV file to make each line has same number of elements? There's a CSV file with 4 columns A,B,C,D, but some lines only have 3 columns A,B and D. How to add a "N/A" as column C for all lines that only have column A,B,D? |
Input Sample: |
a1,b1,c1,d1 a2,b2,d2 a3,b3,c3,d3 a4,b4,c4,d4 a5,b5,d5 ... |
Output Sample: |
a1,b1,c1,d1 a2,b2,N/A,d2 a3,b3,c3,d3 a4,b4,c4,d4 a5,b5,N/A,d5 ... |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. ctrl-o open the CSV file 2. ctrl-h open 'replace' window * set "Replace Unit" to "Chars" * set "Replace Scope" to "Line" * set "Search for Pattern" entry to: * set "Replace with Pattern" entry to: 3. click "Replace", done! 4. ctrl-s save to CSV file. |
Screenshot 1: Replace_Window |
Similar Examples: |
How to insert a blank line after each group of lines with same month? (56%) How to batch rename files by keeping only the numbers at the end? (56%) How to find the maximum number in each line that contains 3 numbers? (55%) How to rename all files by multiplying each number in filename by 3? (54%) How to batch rename files by appending the number of lines at the end? (53%) How to change the number in each line to specified order in a text file? (53%) How to batch rename files by multiplying each number in filename by 2? (53%) How to batch rename files by moving the leading numbers to the end? (53%) |
Check Demo of Advanced search and replace |
Keywords: |
abcd abc same columns csv replace scope scope format chars column add columns same column add number to lines add line column add lines to each file file number format add a number each line search same file |