You are not logged in.
Hi,
Im trying to set up "OpenBox" but I dont want to type all the configfiles by hand. But as there is no software linked in OpenBox yet, I only have FireFox installed
Now I was so clever (!) to copy and paste the configs in Windows and sent by mail to my Linux-system. So far, so good.
When I open the files (sh-scripts etc) I have these ugly Windows-$%&!%%! in these files. The files/scripts are quite long so I dont want to remove by hand.
Can u give me a hint how to remove them using vi automatically? If I remember well there was a command for tha... ("Hallo brain, nobody there?")
Would be great if somebody could help.
Thanks for your efforts,
The Pope
Offline
Use hd2u (pacman -S hd2u).
Offline
cat windowsconfig | sed 's/^M$//' > linuxconfig
And to type the ^M, do ctrl-v then ctrl-m
Offline
@Snowman: Thanks a lot! Big help!!!
@codema: Thanks for the hint, but I am really happy to get rid of these..."symbols"
Offline
another alternative is dos2unix
Offline
@alexpnx: Its strange, I used pacman -S hd2u but used the the command dos2unix -a (...). Means hd2u=dos2unix or dos2unix is part of the base-system (no other packages installed)?
Offline
If you look at the description for hd2u:
dos2unix is filter used to convert plain texts from DOS (CR/LF) format to UNIX format (CR) and vice versa.
And if you look at the file list you'll see that dos2unix belongs to the hd2u package
Offline
@codema: Thanks for the hint, but I am really happy to get rid of these..."symbols"
... what does that mean? My sed _does_ get rid of them. I told you how to type the ^M in the sed script, you need to be using the escape character, not just typing ^M in the console.
Offline
@codemac: I dont get it. But no need, I figured it out. Thanks anyway...
Offline
ok, I really want to get this accross, because you really don't need a binary for every job. That's part of the philosophy of Unix, using general purpose binaries together to do specific tasks.
In this case 'cat' and 'sed'
The first part of the command is 'cat windowsConfig |', putting the file with the annoying ^M onto stdin for the next app on the command line.
The next part is 'sed s/^M$//'. This is the part you aren't understanding. Type "sed s/" then ctrl-v and then ctrl-m. You will then see "sed s/^M" on the console. Type the rest with "$//". The dollar sign means "end-of-line" in Regular Expressions. This command literally means replace ^M$ with nothing.
Thus the resulting command :
cat windowsConfig | sed "s/^M$//" > linuxConfig
If you don't get it yet, google "regular expressions", and be amazed how much of your life has been wasted not knowing them.
Offline
Now I got it... Im sorry for being a little slow in understanding.
Originally, as you can see in my first post, I was looking for sth like that and somehow "know" this feature, Im just not yet familiar with the expressions and syntax. For the moment I just needed a fast and simple solution and the binary was right in time
Anyway, thanks a lot, I will make myself familiar with these expressions. Seems really very useful.
Thanks for ur explanation!!!
Offline
How about this?
tr -d 'r' < INPUTFILE > OUTPUTFILE
(I'm in the process of installing a Smoothwall box at Cybercafé)
Offline