Jump to content

convert text file to fixed-width


homer.favenir

Recommended Posts

hi to all,

can anyone please teach me how can i convert this kind of data (tab delimited)

3003400ACCOUNTANTS					V1						
"1HS             A & A ACCOUNTING & TAX SERVICES"	"A A ACCOUNTING TAX SERVICES"			"770 979-2966"	V2		GA				
"RL              ACCOUNTANTS WAREHOUSE"		"6070 MC*DONOUGH DR N*W"	NORC	"770 326-6302"	V2	NORCROSS	GA	30093	
"RL              ACCOUNTANTS WAREHOUSE"		"6070 MC*DONOUGH DR N*W"		"770 326-6302"	V2	ATLANTA	GA	
"RL              ACCOUN*TAX PROFESSIONAL"				"770 447-1244"	V2		GA				
"RL              ACCOUNTAX SERVICE"		"6000 LIVE OAK PKWY N*W"	NORC	"678 206-0361"	V2	NORCROSS	GA	30093	

to fixed-width exactly like this

   3003400ACCOUNTANTS                                                                                                                                                                                                                             V1
  1HS             A & A ACCOUNTING & TAX SERVICES                                            A A ACCOUNTING TAX SERVICES                                                                              SNVL                            770 979-2966V2
  RL              ACCOUNTANTS WAREHOUSE                                                                                                        6070 MC*DONOUGH DR N*W                                 NORC                            770 326-6302V2
  RL              ACCOUN*TAX PROFESSIONAL                                                                                                                                                                                             770 447-1244V2
  RL              ACCOUNTAX SERVICE                                                                                                            6000 LIVE OAK PKWY N*W                                 NORC                            678 206-0361V2
  2HSW            ACCOUNTING BUSINESS CENTER INC                                                                                               4995-D FRIENDSHIP RD                                   BUFORD                          770 614-6440V2

 

as you can see the text above is all messed up. i like to convert it to exactly like the text below.

and remove the double quote, the last words after V2 in the text above is also included and write the fixed content to a text file. im having a headache here...  :'(

can anyone please...  ;D

Link to comment
https://forums.phpfreaks.com/topic/105260-convert-text-file-to-fixed-width/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.