[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: strip ^M from list of files in for loop
- From: Jake McHenry <jmchenry oak kcsd k12 pa us>
- To: redhat-list <redhat-list redhat com>
- Subject: Re: strip ^M from list of files in for loop
- Date: Sun, 30 Jul 2000 12:21:57 -0400 (EDT)
I'm not quite sure what your asking here, but I'll try.
Did you remove the ^M from the file your trying to run the script on? If the
^M's are in that file, they will probably get put in your file too, is that what
your experiencing?
Try doing this to the file that you want to read from before you run the script
on it.
open the file in an editor ( I use VI ) and type :
this should give you the command line for the editor.
then type 1,$s/^M//g
this will take out all the ^M's in the document.
**Note**
at the editor command line, to get the ^M symbol, you must press and hold the
ctrl button and press the V then M key. Otherwise the ^M symbol won't appear.
Sorry if this is not what you need.
Jake
On Sun, 30 Jul 2000, Bret Hughes wrote:
--I have a script that reads file names (each on a different
--line) from a file, does some work and writes the record read
--
--in from the file and appends ": timestamp" to it.
--
--Later when I am trying to process the file (it is still
--going) with variable=$(tail -1 logfile) the embedded ^M is
--kicking my ass:
--instead of
--/file/name/in/the/log/file: 07/30:10:12:50
--
--the variable contains:
--: 07/30:10:12:50the/file
--looking at the logfile via less shows
--/java/test/html/StreetHead.html^M: 07/30:10:12:50
--
--
--I am using a
--
--for f in $(cat file.names) do
--
-- echo "$f: `date +%m/%d:%H:%M:%S`"
--done
--
--type of deal in the script and redirecting the output of the
--
--script to the logfile.
--
--I know I have seen something on this but searches and man
--bash have been no help.
--
--in perl I think I would use chomp but is there a way to do
--this in sh?
--
--Any help appreciated.
--
--Bret
--
--
----
--To unsubscribe: mail redhat-list-request redhat com with "unsubscribe"
--as the Subject.
--
--
Jake McHenry
jmchenry oak kcsd k12 pa us
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]