The problem with your code is that the shell uses whitespace to delimit words.
Suppose you have a file named "two words", and you write a command like "cp two words" - how is the shell supposed to know wether you want the file "two" copied to "words" or if you are talking about the file "two words" and the second argument is missing?
The same is true for the for-loop, which passes one argument at a time to the content of the loop - and "one argument" is "one word", because this is where the stream the for-loop works on was split at.
So, here is a script which relies on exactly this mechanism:
By the way: do not use for-loops to process lists of unknown length, like a directory listing. If the list grows too long it will exceed your maximum line length (see syslimits.h) and your code will break. Using a while-loop removes this risk.
Gurus -
I got one simple TXT file with long file name with blank spaces in between the words. I am trying to display that full file name, but it breaks while displaying. Could somebody shed some light here?
Script
------
for i in `cat ~\temp\employee.txt`
do
echo $i
done (5 Replies)
Hi,
What's the best way to find all files under a directory - including ones with space - in order to apply a command to each of them. For instance I want get a list of files under a directory and generate a checksum for each file.
Here's the csh script:
#!/bin/csh
set files = `find $1... (5 Replies)
Hello,
I found the mimesender multiple attachment emailing shell script in the FAQ of these forums, and I have been able to use it to send multiple files, but only if they don't have spaces in their file name or path.
When I attempt to send a file with spaces in it's name, enclosed... (0 Replies)
I developed a perl code..And the excerpt from it is given below...
open(HANDLE,$cmp_path) ; #reading the xml file from the file path
while($file_path = <HANDLE>)
I have list of XML files to read from a folder. It has some spaces inside the name of the file...I used "\"... (2 Replies)
please somebody tell me what is wrong with this, while the thumbnail grabbing works and encoding works, but what is not working is, mv $i.jpg /var/www/thumbs/ and mv $i.mp4 /var/www/uploads/
#!/bin/bash
# MINT 9 - FFMPEG - QT-FASTSTART - X264 - MP4
DIR=/var/www/tmp
for i in... (9 Replies)
Hi,
I have a directory with the following file names
01 - abc hyn
02-def
03-ghi.dir
04 - jhu.dir
abc1 kil
def bil
The last two file names abc1 starts with one space and def starts with double space. I want these files in my directory to be renamed as
ABC HYN
DEF
GHI.dir... (6 Replies)
Hi All,
I have a vexing issue with leading spaces in file names. Basically, we're moving tons of data from our ancient afp file share to Box.com and Box forbids leading spaces in files or folders. The HFS file system seems to be perfectly fine with this, but almost all other Unix file systems... (1 Reply)
I am running a UNIX script to get unused files and their sizes from the server. The issue is arising due to the spaces present in the filename/folder names.Due to this the du -k command doesn't work properly.But I need to calculate the size of all files including the ones which have spaces in them.... (4 Replies)
Hi All,
The output file contains data as below.
"20141023","CUSTOMER" ,"COMPANY" ,"IN0515461" ,"" ,"JOSHUA"
There are spaces in between the ending " and ,. The number of spaces is random.
How can I remove that from the file so that the final output is:... (4 Replies)
Hi,
I'm using a shell script. I have extracted current date files to a directory1 and the date should be removed on both sides of a CSV file.
FYI... I'm looking to remove the date from the file name and not inside the CSV file.
Directory1
2017-07-12_gmr_tag_log_20170711.csv... (0 Replies)
Discussion started by: shivamayam
0 Replies
LEARN ABOUT DEBIAN
astro::fits::header::gsd
Astro::FITS::Header::GSD(3pm) User Contributed Perl Documentation Astro::FITS::Header::GSD(3pm)NAME
Astro::FITS::Header::GSD - Manipulate FITS headers from GSD files
SYNOPSIS
use Astro::FITS::Header::GSD;
$hdr = new Astro::FITS::Header::GSD( Cards => @cards );
$hdr = new Astro::FITS::Header::GSD( gsdobj => $gsd );
$hdr = new Astro::FITS::Header::GSD( File => $file );
DESCRIPTION
This module makes use of the Starlink GSD module to read from a GSD header.
It stores information about a FITS header block in an object. Takes an hash as an argument, with either an array reference pointing to an
array of FITS header cards, or a filename, or (alternatively) a GSD object.
METHODS
configure
Reads a header from a GSD file.
$hdr->configure( Cards => @cards );
$hdr->configure( Items => @items );
$hdr->configure( gsdobj => $gsd );
$hdr->configure( File => $filename );
Accepts a GSD object or a filename. If both "gsdobj" and "File" keys exist, "gsdobj" key takes priority.
writehdr
The GSD library is read-only. The writehdr method is not implemented for this sub-class.
NOTES
This module requires the Starlink GSD module.
GSD supports keys that are longer than the 8 characters allowed as part of the FITS standard. GSD keys are truncated to 8 characters by
this module.
SEE ALSO
NDF, Astro::FITS::Header, Astro::FITS::Header::Item Astro::FITS::Header::CFITSIO, Astro::FITS::Header::NDF
AUTHORS
Tim Jenness <t.jenness@jach.hawaii.edu>, Alasdair Allan <aa@astro.ex.ac.uk>
COPYRIGHT
Copyright (C) 2008-2011 Science & Technology Facilities Council. Copyright (C) 2001-2002 Particle Physics and Astronomy Research Council.
All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place,Suite 330, Boston, MA 02111-1307, USA
perl v5.14.2 2012-06-30 Astro::FITS::Header::GSD(3pm)