<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><P class=MsoNormal style="MARGIN: 0in 0in 10pt; tab-stops: 125.75pt"><FONT face=Calibri size=3>I am new to Python but have used many other (mostly dead) languages in the past.<SPAN style="mso-spacerun: yes"> </SPAN>I want to be able to process *.txt and *.csv files.<SPAN style="mso-spacerun: yes"> </SPAN>I can now read that and then change them as needed – mostly just take a column and do some if-then to create a new variable.<SPAN style="mso-spacerun: yes"> </SPAN>My problem is sorting these files:</FONT></P>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; tab-stops: 125.75pt; mso-list: l0 level1 lfo1"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>1.)</FONT><SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN></SPAN><FONT face=Calibri size=3>How do I sort file1.txt by position and write out file1_sorted.txt; for example, if all the records are 100 bytes long and there is a three digit id in the position 0-2; here would be some sample data:</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; tab-stops: 125.75pt; mso-list: l0 level2 lfo1; mso-add-space: auto"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>a.</FONT><SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN></SPAN><FONT face=Calibri size=3>001JohnFilben……</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; tab-stops: 125.75pt; mso-list: l0 level2 lfo1; mso-add-space: auto"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>b.</FONT><SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN></SPAN><FONT face=Calibri size=3>002Joe<SPAN style="mso-spacerun: yes"> </SPAN>Smith…..</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; tab-stops: 125.75pt; mso-list: l0 level1 lfo1"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>2.)</FONT><SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>How do I sort file1.csv by column name; for example, if all the records have three column headings, “id”, “first_name”, “last_name”; <SPAN style="mso-spacerun: yes"> </SPAN>here would be some sample data:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; tab-stops: 125.75pt; mso-list: l0 level2 lfo1; mso-add-space: auto"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>a.</FONT><SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Id, first_name,last_name<o:p></o:p></FONT></FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; tab-stops: 125.75pt; mso-list: l0 level2 lfo1; mso-add-space: auto"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>b.</FONT><SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN></SPAN><FONT face=Calibri size=3>001,John,Filben</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; tab-stops: 125.75pt; mso-list: l0 level2 lfo1; mso-add-space: auto"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>c.</FONT><SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN></SPAN><FONT face=Calibri size=3>002,Joe, Smith</FONT></P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; tab-stops: 125.75pt; mso-list: l0 level1 lfo1"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>3.)</FONT><SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN></SPAN><FONT face=Calibri size=3>What about if I have millions of records and I am processing on a laptop with a large external drive – basically, are there space considerations? What are the work arounds.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt; tab-stops: 125.75pt"><FONT face=Calibri size=3>Any help would be appreciated. Thank you.</FONT></P>
<DIV></DIV>
<DIV><BR> </DIV>John Filben<BR>Cell Phone - 773.401.2822<BR>Email - johnfilben@yahoo.com
<DIV></DIV></div><br>
</body></html>