The UNIX and Linux Forums
>
Top Forums
>
UNIX for Dummies Questions & Answers
How to find a word in a all the files in a Directory??
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
How to find a word in a all the files in a Directory??
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
5
(
permalink
)
10-03-2008
era
Herder of Useless Cats (On Sabbatical)
Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Replace the last command with something like
Code:
sed
-e 's/NULL//g' -e "2,\$s/,/,'/" $fname >$fname.new
This adds a single quote immediately after the first comma, except on the first line. Take out the
2,\$
prefix if you want it on the first line, too.
All the other occurrences of cat are Useless, too;
sed
is perfectly capable of reading from a named file all by itself.
era
View Public Profile
Visit era's homepage!
Find all posts by era
Find era's past nominations received
Find era's present nominations given