PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Removing new line character ^M
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Removing new line character ^M

Réponse
 
LinkBack Outils de la discussion
Vieux 02/12/2006, 21h57   #1
ryandle@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Removing new line character ^M

Hello all.

I am currently working on a script that is doing some simple processing
of files. I have it set up to create a file with a math expression in
it so that i can use BC to get the answer, a typical one looks like
this:

#file
-34.23+403.3

this file is getting created from the paste command, merging two
previous files. The problem is that it as adding the end of line
character ^M to the end, and bc throws an error every time it reads the
file. Ive been looking for a way to remove this character...i have
tried some sed one liners that ive come across but none seem to work.
any would be appreciated. thanks!

  Réponse avec citation
Vieux 02/12/2006, 22h01   #2
Janis Papanagnou
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Removing new line character ^M

ryandle@gmail.com wrote:
> Hello all.
>
> I am currently working on a script that is doing some simple processing
> of files. I have it set up to create a file with a math expression in
> it so that i can use BC to get the answer, a typical one looks like
> this:
>
> #file
> -34.23+403.3
>
> this file is getting created from the paste command, merging two
> previous files. The problem is that it as adding the end of line
> character ^M to the end, and bc throws an error every time it reads the
> file. Ive been looking for a way to remove this character...i have
> tried some sed one liners that ive come across but none seem to work.
> any would be appreciated. thanks!
>


The command dos2unix removes that character.
Or use a filter tr -d '\015'

Janis
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h10.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 3,31028 seconds with 10 queries