|
Home > Archive > Unix Shell > August 2007 > hidden linefeed
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| osiris@abydos.kmt 2007-08-24, 7:18 pm |
| Somehow the filename in the script below has a hidden linefeed.
Is there anyway that I can remove it?
Thanks a bunch.
#! /bin/bash -f
for file in `ls`
do
if [ "${file##*.}" != "jpg" ] ; then
continue
fi
W=$( sips -g dpiWidth "$file" |awk -F: '{print $2}' )
FILE="${file##*/}"
DPI="${W%.*}"
printf "%s %s\n" "$FILE" "$DPI"
done
| |
| Cyrus Kriticos 2007-08-24, 7:18 pm |
| osiris@abydos.kmt wrote:
> Somehow the filename in the script below has a hidden linefeed.
> Is there anyway that I can remove it?
> Thanks a bunch.
>
> #! /bin/bash -f
> for file in `ls`
Try:
for file in *
> do
> if [ "${file##*.}" != "jpg" ] ; then
> continue
> fi
> W=$( sips -g dpiWidth "$file" |awk -F: '{print $2}' )
> FILE="${file##*/}"
> DPI="${W%.*}"
> printf "%s %s\n" "$FILE" "$DPI"
> done
--
Best | "Was bekommt man/frau, wenn man/frau Software kauft?
regards | Nichts außer einem Haufen Nullen und Einsen."
Cyrus | -- aus d. Lizenzvereinbarung von Spybot Search&Destroy
| |
| Bill Marcum 2007-08-24, 7:18 pm |
| On Fri, 24 Aug 2007 20:02:22 GMT, osiris@abydos.kmt
<osiris@abydos.kmt> wrote:
>
>
> Somehow the filename in the script below has a hidden linefeed.
> Is there anyway that I can remove it?
> Thanks a bunch.
>
for file in *.jpg
do
newname=$(echo "$file" | tr -dc '[:graph:]')
if [ ! -f "$newname" ] && [ ! -z "$newname" ]; then
mv "$file" "$newname"
done
--
What's page one, a preemptive strike?
-- Professor Freund, Communication, Ramapo State College
|
|
|
|
|