Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

batch empy lines removal

Original Message
Name: the666th
Date: October 11, 2007 at 12:09:55 Pacific
Subject: batch empy lines removal
OS: windows xp professional
CPU/Ram: 1.25gb
Comment:
hello, I work often with text files that contains this structure:
"
text and numbers


text and numbers


text and numbers


................


text and numbers"

etc...and I need to remove the two empty lines from between the text and numbers lines...I don't know any programming so if u could serve the script on a plate would be nice :D


Report Offensive Message For Removal


Response Number 1
Name: tonysathre
Date: October 11, 2007 at 14:13:57 Pacific
Subject: batch empy lines removal
Reply: (edit)
findstr "." yourfile.txt >> clean.txt

"Computer security." — Oxymoron


Report Offensive Follow Up For Removal

Response Number 2
Name: IVO
Date: October 12, 2007 at 02:22:55 Pacific
Subject: batch empy lines removal
Reply: (edit)
I suggest the following, if tonysathre's script gets troubles.

Echo Off > clean.txt
For /F "tokens=* delims=" %%a in (file.txt) Do (
Echo.%%a>> clean.txt)


Report Offensive Follow Up For Removal

Response Number 3
Name: the666th
Date: October 12, 2007 at 11:16:41 Pacific
Subject: batch empy lines removal
Reply: (edit)
I'm sorry if I may sound stupid...I dont know what programming sintax is that u use here, but I assumed is vbs...I made a file with the code u gave me here modified the name of my text file in what is stated in these scripts and changed its extension to .vbs but I get errors on both...On IVO's code I get "Expected Identifier" at line 2 char 5 code"800A03F2", and at tonysathre's "Expected end of statement" at line 1 char 13 code "800A0401". So I would be very very greatful if u'd tell me what to do step by step as to a totally noob...thanx for being kind enough to help

Report Offensive Follow Up For Removal

Response Number 4
Name: IVO
Date: October 12, 2007 at 12:10:37 Pacific
Subject: batch empy lines removal
Reply: (edit)
Tonysathre's tip is just one command to be entered at command prompt after you changed the folder to that holding your file (by issuing CD C:\....path of filename).

My (IVO) is a batch script not a VBS one, so it have to be suffixed by .bat (e.g. X.bat).

Run it first changing folder as for tonysathre's command then type X.

It's hard however to drive a plane without no knowledge of flying. BTW The666 was my old ID for computing account at University time.


Report Offensive Follow Up For Removal

Response Number 5
Name: the666th
Date: October 12, 2007 at 13:24:35 Pacific
Subject: batch empy lines removal
Reply: (edit)
Thanx a bunch IVO, it works :D
Thank you, thank you, thank you, thank you, thank you...

But I'm wondering if it can be done without the necessity of a fixed txt file name, or to change the txt file name within the batch file...if that's not too troublesome
----------------------
Off topic...I don't know why or what signification The666 had for you , but my "the666th" is always written in small letters and it means a person wich isn't the first the2nd or any other elite persons it's number 666 wich has a satanic connotation, but is not based on it to much and the fact that is also written in small letters says more about his insignificant valor...and with all this he still is a feared person, something like fear of the unknown :D


Report Offensive Follow Up For Removal


Response Number 6
Name: IVO
Date: October 12, 2007 at 14:24:24 Pacific
Subject: batch empy lines removal
Reply: (edit)
Here the generalized version of the script to be invoked by typing BatchName Path\filename (e.g. Clean C:\MyFolder\MyText.txt)

@Echo Off
Echo.
If not exist "%~f1" (Echo File "%~f1" not found & GoTo :EOF)
Type Nul > "%~dpn1.new"

For /F "tokens=* delims=" %%a in ('Type "%~f1"') Do (
Echo.%%a>> "%~dpn1.new")

Echo "%~f1" --^> "%~dpn1.new"
Echo.
:: [End_Of_Batch]

Warnings: spaces not allowed.

About The666: That was THE666 as at that time only uppercase chars were allowed (punched cards for UNIVAC 1108) and yes 666 was the satanic signature as I was nicknamed Dr. Strangelove (do you get it), but that is another story.


Report Offensive Follow Up For Removal

Response Number 7
Name: the666th
Date: October 12, 2007 at 16:11:52 Pacific
Subject: batch empy lines removal
Reply: (edit)
Ok, thanx for sharing your knowledge with others...you really helped me a lot.

------------
Off topic...I didn't really get it because I don't know who Dr.Strangelove was...if it's related with Stanley Kubrick's movie I'll read a review or even watch the movie.


Report Offensive Follow Up For Removal

Response Number 8
Name: ghostdog
Date: October 13, 2007 at 01:57:51 Pacific
Subject: batch empy lines removal
Reply: (edit)
if you have sed,

sed '/^$/d' file



Report Offensive Follow Up For Removal

Response Number 9
Name: IVO
Date: October 13, 2007 at 02:55:00 Pacific
Subject: batch empy lines removal
Reply: (edit)
Dr. Strangelove I refer to is Kubrick's carachter in same titled movie. He was a mad scientist tailored from Edward Teller, the real scientist who developed the H bomb.

I was so nicknamed due to the huge stress my code produced to the very powerfull UNIVAC.

Forget him and enjoy your young age.


Report Offensive Follow Up For Removal

Response Number 10
Name: Mechanix2Go
Date: October 13, 2007 at 05:49:33 Pacific
Subject: batch empy lines removal
Reply: (edit)
"punched cards for UNIVAC 1108"

good grief



=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 11
Name: IVO
Date: October 13, 2007 at 09:33:32 Pacific
Subject: batch empy lines removal
Reply: (edit)
"good grief"

as you quoted, the cards were punched using IBM 029 equipment and control statements marked by @ in first column (e.g. "@FOR IS,MAIN") had to be punched by stopping the card to advance by hand and typing "7/8" (key 7 and 8 in sequence). Not to say students' runs were skeduled during night shift...


Report Offensive Follow Up For Removal

Response Number 12
Name: Razor2.3
Date: October 15, 2007 at 18:46:40 Pacific
Subject: batch empy lines removal
Reply: (edit)
...punched cards for UNIVAC 1108...

I was feeling old. Then I read this thread. Now I feel painfully young. Thanks a lot, guys.


Report Offensive Follow Up For Removal

Response Number 13
Name: IVO
Date: October 16, 2007 at 02:35:50 Pacific
Subject: batch empy lines removal
Reply: (edit)
I'm painfully glad to come from those days: the moon, the nuclear power, the future were at your hand; you actually was feeling to be on the border of the impossible. And when you went out from the computer room, there always was a nice girl to spend together the late hours of night. Shortly I WAS YOUNG as young I feel today too..

Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: batch empy lines removal

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




Slow boot time

Trasnferring Documents from old HD

My k8T Neo-v usb's aren't working!

Date Modified = Date Created Time

system files on removable harddrive


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

All content ©1996-2007 Computing.Net, LLC