Programming problem

If you want to talk about your personal paperweight, you've found the right place!

Moderator: Moderators

Programming problem

Postby Goatee » Sat Aug 12, 2006 15:09

I decided a while ago that I was going to make a python code optimiser and that I was going to call it codegoat ('cos it eats the rubbish).

I made a start, and then after reading about a thousand 'teach yourself python' and 'teach yourself shell script' things I created a sort of launch script in shell. In general it is fine but for some reason this line:

Code: Select all
echo $2 > /home/me/workon.txt


is adding in a blank line underneath the text. :x This would be fine but $2 is a filename and both bash and python say the file doesn't exist. If I go and remove this empty line in kate and run the next module then it's ok but it'd be better not to have to.

If anyone knows how to get rid of the blank line it would help a lot.

Thanks in advance :D
User avatar
Goatee
Sharecropper
 
Posts: 599
Joined: Fri May 05, 2006 16:15
Location: England, UK

Postby cvill64 » Sat Aug 12, 2006 19:01

Usually the easiest way to work on files at getting rid of all lines, is to read the lines in and then read the lines out to STOUT with no lines in perl, let me know if you need to know more information
cvill64
Sagely Hen
 
Posts: 2185
Joined: Fri Dec 30, 2005 10:03
Location: Virginia, USA

Postby backtrace » Sat Aug 12, 2006 21:12

Just use "echo -n <your subliminal messages>". Easy as that.

Damn, I hate posts with so little text in them, and ranting about all sorts of unnecessary things here? Nah, let's not do that.
backtrace
Baby Hen
 
Posts: 2
Joined: Sat Aug 12, 2006 21:09
Location: Netherlands

Postby Goatee » Sun Aug 13, 2006 7:00

Thanks, it's fixed now.

I thought i'd start with backtrace's solution (which worked) because my perl is dire but i'll take note yours cvill. I do note down every code snippet posted here, it's where I got >.

It's great to get such good help so fast!
Thanks again

:D
User avatar
Goatee
Sharecropper
 
Posts: 599
Joined: Fri May 05, 2006 16:15
Location: England, UK


Return to Off Topic

Who is online

Users browsing this forum: No registered users and 2 guests