way1000 Posted May 25, 2016 Share Posted May 25, 2016 (edited) i have a text file that contains words that repeat randomly, i have to sort the words by order of some sort the text file looks like this: why when why when why when why when why when why when why when why when why when why when why when why when i have to sort the words in this order (still repetitive) why why when why why why why when why why why why when why why why why when why why i attached the text file in which the words have t be sorted thanks a lot in advance WordList1.txt Edited May 25, 2016 by way1000 Link to comment Share on other sites More sharing options...
spudw2k Posted May 25, 2016 Share Posted May 25, 2016 Well, for one thing it looks like you are not sorting, but parsing, otherwise you'd have the same amount of output lines, but you are obviously omitting "when"s from the output. It looks more like a pattern recognition of some sorts, but without knowing what the end goal is it may only be tailored for this single scenario. For example, what happens if you use other words for input? What if the input words aren't laid out in an alternating fashion? How do you expect the last when to be handled?...ignored? I'm sorry, but it is just not clear to me what pattern you are trying to produce. In simplest terms, for this input example you could use the following logic: read first line in text file print read line twice read next line in text file print read line once read next line in text file print read line twice print newline/crlf repeat until end of file. of course to deal with the EOF you need some sort of check for that if you want "good" output. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now