I have 1 file txt have 1000 lines.
1/Such as :
id---name---dob---address---email
12---John---11101978---456 Texas---abs@aol.com
13---John---12121978---423 Texas---xax@aol.com
Result :
dob---id---name---dob---address---email
11101978---12---John---11101978---456 Texas---abs@aol.com
12121978---13---John---12121978---423 Texas---xax@aol.com
2/ Such as :
id---name---day---month---year---address---email
12---John---11---10---1978---456 Texas---abs@aol.com
13---John---12---12---1978---423 Texas---xax@aol.com
Result :
day---month---year---id---name---day---month---year---address---email
11---10---1978---12---John---11---10---1978---456 Texas---abs@aol.com
12---12---1978---13---John---12---12---1978---423 Texas---xax@aol.com
3/Such as :
ID---email---address---phone---name
12---asf@awe.com---456 Texas---1234567890---John
13---awer@yahoo.com---123 Cali---9852367921---Mary
Result:
ID---name---email---phone---address
12---John---asf@awe.com---1234567890---456 Texas
13---Mary---awer@yahoo.com---9852367921---123 Cali
Plzz help me.Thanks.
Change order of fields in text file with 1000 lines
-
- Posts: 13
- Joined: Mon Aug 20, 2007 9:25 am
Re: Change order of fields in text file with 1000 lines
Go to main menu - Action - Options - Batch Replace
check "Modifier M"
uncheck "Modifier S"
uncheck "Modifier G"
Go to Batch replace tab, check on "Use regular expressions".
For the first case use the following:
Search for:
^(\d+---.*---)(\d+---)
Replace with:
$2$1$2
For the second case use the following:
Search for:
^(\d+---.*---)(\d+---\d+---\d+---)
Replace with:
$2$1$2
For the third case use the following:
Search for:
^(\d+)---(.*)---(.*)---(.*)---(.*)$
Replace with:
$1---$5---$2---$4---$3
That's all I verified it works perfectly.
check "Modifier M"
uncheck "Modifier S"
uncheck "Modifier G"
Go to Batch replace tab, check on "Use regular expressions".
For the first case use the following:
Search for:
^(\d+---.*---)(\d+---)
Replace with:
$2$1$2
For the second case use the following:
Search for:
^(\d+---.*---)(\d+---\d+---\d+---)
Replace with:
$2$1$2
For the third case use the following:
Search for:
^(\d+)---(.*)---(.*)---(.*)---(.*)$
Replace with:
$1---$5---$2---$4---$3
That's all I verified it works perfectly.
-
- Posts: 13
- Joined: Mon Aug 20, 2007 9:25 am
Re: Change order of fields in text file with 1000 lines
Many thanks to Roman & site.