Name: jackngill Date: April 8, 2006 at 12:05:09 Pacific Subject: Unix/dos amending text OS: Windows/DOS CPU/Ram: 384 Model/Manufacturer: Acer
Comment:
Well this may start out a tad bit confusing but here goes: Dossy bit - I have managed to condense the output details from mem.exe in batch to get a single line of text using: MEM.EXE | FIND.EXE /I "Total memory" >> C:\r1.txt which produces in r1.txt:- Total<1space> memory<6Spaces>131,008K<7spaces>489K<3spaces>130,519K (all 1 line in r1.txt the <space> bit is just to indicate blank space separations)
I have heard of 2No utils which are used in UNIX but can be used in DOS (Batch) that can amend/remove text & numbers so that I am just left with say the first block of numbers without the comma's & the K's at the end of each block of numbers. The 2No programs are TR & SED, however I am unfamiliar with the syntax to remove Total memory, all the comma's & the K's from the first set of numbers then the remaining two blocks of numbers, comma's & K's also. Any one who is familiar with preferably TR, could they reply with the suitable syntax/code & squeeze/remove any blank spaces. The nearest stab i could make at it was, don't laugh!: echo Totalmery | tr -d 'Totalmery' >> r1.txt then possibly to squeeze multiple charaters into one set numbers: ls -l | tr -s ' ' The removal of the 2 other blocks of numbers I haven't got a clue about? I want to wind up with 131008 nothing else in r1.txt or possibly r2.txt. Regards, appreciably yours, Dave
Thanks for the reply I don't have a clue about perl programming or compiling sorry! If I was to use TR in several passes what would the code be as TR is a smaller program? If not what would the SED code be please. I was hoping to use this generally on different PC's with different amounts of RAM/MEM installed that would involve %Variables% way 2 complicated for me! I have noticed that the above code presumeably wouldn't remove the other 2No blocks of numbers yes?
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE