Re: system ("cd ..")



On Mon, 29 Aug 2005, Eliyah Kilada wrote:

> - I agree with [you] that a shell script is more appropriate, but how
> can I write regular expressions in this way ? ;-)

By typing them, naturally :-)

In shell scripts, grep, sed & awk are the common regex using tools;
depending on what you're doing, one or another might be the most useful
one to make use of in a script.

grep does basic regex pattern matching

sed is a Stream EDitor, and can do regex substitutions etc

awk is more complex, almost like a baby version of Perl, but weirder

For my needs, grep & sed are usually enough for most simple shell
scripts, and if I need to make it complex enough that I'm considering
using awk, I just write the whole thing in Perl instead. On the other
hand, a lot of people, eveen now, use awk all the time.

In any case, there are several useful ways to get regexes into your
shell scripts, should you have the need to do so.



--
Chris Devers
.



Relevant Pages

  • Re: grep the 2nd last line from the list of files
    ... for anything else you should just use awk, perl, ruby, etc. Showing ... that, like the sed solution, it'd fail if the file name contained 2 ... Chances are you're doing procedural programming in your shell scripts. ...
    (comp.unix.shell)
  • Re: Interesting math
    ... want them to be robust. ... I write a lot of shell scripts, ... anything you could do from a C program, or an awk program for that matter. ...
    (alt.usage.english)
  • Re: Cut with multiple consequitive delimiters - anyone??
    ... shell scripts and executables. ... This source file contains 3 types of records. ... You need to use awk, ... awk will treat sequences of white space as one delimitter and can select different fields to print based on the input format, ...
    (comp.unix.questions)
  • Re: [OT] Sed and Awk
    ... >> awk program that cannot be duplicated with sed at all. ... Normally both sed and awk are used in shell scripts together ... Using assembler makes sense only if programmer's time is really cheap ...
    (comp.unix.shell)
  • Re: write out filenames of files existing on a filesystem into afile
    ... people wrote shell scripts that couldn't deal with spaces in ... legal and matches that regex) that your program will overlook. ... Security hole. ... Even if you think only insane ...
    (perl.beginners)