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 > Hex for ^M
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Hex for ^M

Réponse
 
LinkBack Outils de la discussion
Vieux 30/04/2008, 20h43   #1
NeOnD
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Hex for ^M

Hi,

I have a script which seeks for ^M in files. e.g. it include a line
say -
find $(pwd) -type f -exec grep -l '^M' {} \;

Sometime while editing this script in Windows I mess with ^M & the
only way to restore is to go in Unix & edit the file in vi & come
back.
So as a remedy (what I could think of) is there some HEX alternative I
could use for ^M ? Or anything else which represents ^M.

10x
NeO
  Réponse avec citation
Vieux 30/04/2008, 21h22   #2
steven_nospam at Yahoo! Canada
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Hex for ^M

On Apr 30, 3:43 pm, NeOnD <vikas...@gmail.com> wrote:
> Hi,
>
> I have a script which seeks for ^M in files. e.g. it include a line
> say -
> find $(pwd) -type f -exec grep -l '^M' {} \;
>
> Sometime while editing this script in Windows I mess with ^M & the
> only way to restore is to go in Unix & edit the file in vi & come
> back.
> So as a remedy (what I could think of) is there some HEX alternative I
> could use for ^M ? Or anything else which represents ^M.
>
> 10x
> NeO


This should work:

find $(pwd) -type f -exec grep -l "$(echo "\r")" {} \;
  Réponse avec citation
Vieux 30/04/2008, 21h32   #3
NeOnD
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Hex for ^M

That works buddy. Thanks
  Réponse avec citation
Vieux 01/05/2008, 05h04   #4
Jeenu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Hex for ^M

On May 1, 12:43 am, NeOnD <vikas...@gmail.com> wrote:
> Hi,
>
> I have a script which seeks for ^M in files. e.g. it include a line
> say -
> find $(pwd) -type f -exec grep -l '^M' {} \;
>
> Sometime while editing this script in Windows I mess with ^M & the
> only way to restore is to go in Unix & edit the file in vi & come
> back.
> So as a remedy (what I could think of) is there some HEX alternative I
> could use for ^M ? Or anything else which represents ^M.
>
> 10x
> NeO


If you are using bash, you can enter character verbatim by pressing
Control-V followed by that character. In your case:
.... -exec grep -l '^M' {} \;

where, the '^M' above is not '^' and 'M', rather it's a control-v
control-m
  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 09h59.


Édité par : vBulletin® version 3.7.2
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
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09950 seconds with 12 queries