[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A very simple question on SED or AWK for a GURU, possibly a lisp scr
From: |
ericjb |
Subject: |
Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files |
Date: |
14 Jan 2003 10:18:01 -0800 |
gnuist006@hotmail.com (gnuist006) writes:
> Here is the type of lines I have in a file:
>
> junk label="junk1/junk2/junk3/.../junkn/" more junk
>
> I want to find every line that has
>
> label="..."
>
> pattern
>
> and then I want to replace every / by _ inside the
> quotes.
>
> For the purposes of continuity, I want the script to look like this:
>
> cat file |
> sed commands |
> awk commands |
>
> etc.
>
> I do not care if it all sed or awk or in what order.
Can we assume that the only double quotes are those surrounding the
label string? If so, you can use that to split the input file into
three files, something like:
cat file | cut -f1 -d\" > file1
cat file | cut -f2 -d\" > file2
cat file | cut -f3 -d\" > file3
sed 's/\//_/g' < file2 > file2.new
paste -d\" file1 file2.new file3 > outputfile
I didn't test this, but it might work...
--
Eric Backus
R&D Design Engineer
Agilent Technologies, Inc.
425-335-2495 Tel
- A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files, gnuist006, 2003/01/13
- Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files, Christopher J. White, 2003/01/13
- Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files, Friedrich Dominicus, 2003/01/14
- Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files, gnuist006, 2003/01/14
- Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files,
ericjb <=
- Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files, Alan Mackenzie, 2003/01/14
- Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files, Kaz Kylheku, 2003/01/14