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 > how to make a script of this one-liner...
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

how to make a script of this one-liner...

Réponse
 
LinkBack Outils de la discussion
Vieux 25/04/2008, 16h30   #1
Arnaud Dagnelies
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut how to make a script of this one-liner...


Hello,
I would like to write a small script used as follows:

igrep ***

That basically simply performs the grep and formats the output in a
special way using another script. In short, what should be executed
is:

grep *** | someScript

....where the *** is anything that can be given to grep. Thus not only
the pattern and files but also including flags and params and so on.

What would be the easiest way to do that?
  Réponse avec citation
Vieux 25/04/2008, 17h10   #2
Glenn Jackman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to make a script of this one-liner...

At 2008-04-25 11:30AM, "Arnaud Dagnelies" wrote:
>
> Hello,
> I would like to write a small script used as follows:
>
> igrep ***
>
> That basically simply performs the grep and formats the output in a
> special way using another script. In short, what should be executed
> is:
>
> grep *** | someScript
>
> ...where the *** is anything that can be given to grep. Thus not only
> the pattern and files but also including flags and params and so on.
>
> What would be the easiest way to do that?


If you use a POSIX shell, use a function:

igrep() {
grep "$@" | somescript
}


--
Glenn Jackman
"If there is anything the nonconformist hates worse than a conformist,
it's another nonconformist who doesn't conform to the prevailing
standard of nonconformity." -- Bill Vaughan
  Réponse avec citation
Vieux 25/04/2008, 17h14   #3
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to make a script of this one-liner...

On 2008-04-25, Arnaud Dagnelies <arnaud.dagnelies@gmail.com> wrote:
>
>
>
> Hello,
> I would like to write a small script used as follows:
>
> igrep ***
>
> That basically simply performs the grep and formats the output in a
> special way using another script. In short, what should be executed
> is:
>
> grep *** | someScript
>
> ...where the *** is anything that can be given to grep. Thus not only
> the pattern and files but also including flags and params and so on.
>
> What would be the easiest way to do that?


If someScript doesn't change, you might consider using awk or perl.
  Réponse avec citation
Vieux 26/04/2008, 10h42   #4
Arnaud Dagnelies
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to make a script of this one-liner...

thx, great, i'll try that
  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 13h29.


É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 0,08499 seconds with 12 queries