Hey there, this is my first post and I'll try to explain my situation as best I can.Here is a sample of the input file:
As you can see there are filenames and directories with spaces in them.
I need to format this file, in order to upload to a DB2 database, therefore each field had to be set to a specific character length, which I have accomplished using the following awk line:
This works, but not for the lines that have spaces in filenames or directories.
Any help would be much appreciated.If you need more info just let me know.
Here is the main line in my script
Thanks
Rodan
Last edited by Franklin52; 06-01-2010 at 09:49 AM..
Reason: Please use code tags!
I have a problem with the script below
#!/bin/sh
for vo in `find -maxdepth 1 -type f -regex "^\./*$"`
do
ls -l "$vo"
some other commands
done
It works fine until `find ...` returns files with spaces. I've tryed to change IFS but haven't succeed
Any solutions? (4 Replies)
I'm trying to do something like that:
for $filename in `ls -1`
do
some_command $filename
done
but it doesn't work properly for file names with spaces, for...in splits at spaces. Anyway around? (4 Replies)
I have files on my unix boxes that users have created with spaces.
Example: /tmp/project plan
ls -l "/tmp/project plan" works fine.
$/tmp>ls -l "/tmp/project plan"
-rw-r--r-- 1 root other 0 Jan 31 12:32 /tmp/project plan
I created a file called test and put just the... (2 Replies)
Hi All,
I see similar problems in past threads but so far no answers have worked for me. I am trying to write a script which parses a txt file that contains one filename per line, then finds those files on the local disk and copies them to a specified directory.
What I have:
... (4 Replies)
Hi
I hope someone will be able to resolve this little teaser!
I am running a script
for file in `ls directory`
do
echo "$file"
...other code here....
done
this works fine unless we receive a file with a name which has a space in it
ie
"filena me"
(I know its not good... (8 Replies)
I want to ftp all the sh files in the directory. Also if any of the file name
contains spaces in them, it should be converted to underscores before it is ftped. I wrote the following code below:
FILESSH=$(ls /mysh/*.sh)
--- FILESH being used here for some other task ---
echo "$FILESSH" |... (3 Replies)
I have the following code:
find /usr/local/test5 -type f -mtime +30 -exec ls -l {} \; | awk '{print $5, $6, $7, $8, $9}'
I have this as output:
14 Aug 12 00:00 /usr/local/test5/file1
14 Aug 12 00:00 /usr/local/test5/lastname,
The bolded part is where I run into trouble. The actual... (4 Replies)
Hello all,
I want to list the file contents of the directory and number them. I am using la and awk to do it now,
#ls |awk '{print NR "." $1}'
1. alpha
2. beta
3. gamma
The problem I have is that some files might also have some spaces in the filenames.
#ls
alpha beta gamma ... (7 Replies)
Hi,
I have files like below, In files coming as spaces. Before transfering those files into ftp server. I want to remove the spaces and then can transfer the files into unix server.
e.g: filenames are
1) SHmail _profile001_20120908.txt
2) SHmail_profile001 _20120908.txt
3) sh... (3 Replies)
I'm trying to handle some files with spaces in their name using "" or \ . Like "file 1" or file\ 1.
My current confusion can be expressed by the following shell script:
#!/bin/bash
touch "file 1" "file 2"
echo -n "ls: " ; ls
echo ---
for file in "file 1" "file 2" ; do
echo $file... (9 Replies)
DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server(3) User Contributed Perl DocumentationDBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server(3)NAME
DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server - Support for Microsoft SQL Server via DBD::ADO
SYNOPSIS
This subclass supports MSSQL server connections via DBD::ADO.
DESCRIPTION
The MSSQL specific functionality is provided by DBIx::Class::Storage::DBI::MSSQL.
EXAMPLE DSN
dbi:ADO:provider=sqlncli10;server=EEEBOXSQLEXPRESS
CAVEATS
identities
"_identity_method" is set to @@identity, as "SCOPE_IDENTITY()" doesn't work with DBD::ADO. See "IMPLEMENTATION NOTES" in
DBIx::Class::Storage::DBI::MSSQL for caveats regarding this.
truncation bug
There is a bug with MSSQL ADO providers where data gets truncated based on the size of the bind sizes in the first prepare call:
<https://rt.cpan.org/Ticket/Display.html?id=52048>
The "ado_size" workaround is used (see "ADO Providers" in DBD::ADO) with the approximate maximum size of the data_type of the bound column,
or 8000 (maximum VARCHAR size) if the data_type is not available.
Please report problems with this driver and send patches.
LongReadLen
"LongReadLen" is set to "LongReadLen * 2 + 1" on connection as it is necessary for some LOB types. Be aware of this if you localize this
value on the $dbh directly.
binary data
Due perhaps to the ado_size workaround we use, and/or other reasons, binary data such as "varbinary" column data comes back padded with
trailing "NULL" chars. The Cursor class for this driver (DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::Cursor) removes them, of
course if your binary data is actually "NULL" padded that may be an issue to keep in mind when using this driver.
uniqueidentifier columns
uniqueidentifier columns come back from ADO wrapped in braces and must be submitted to the MSSQL ADO driver wrapped in braces. We take care
of this transparently in this driver and the associated Cursor class (DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::Cursor) so that
you don't have to use braces in most cases (except in literal SQL, in those cases you will have to add the braces yourself.)
fractional seconds
Fractional seconds with DBIx::Class::InflateColumn::DateTime are not currently supported, datetimes are truncated at the second.
AUTHOR
See "AUTHOR" in DBIx::Class and "CONTRIBUTORS" in DBIx::Class.
LICENSE
You may distribute this code under the same terms as Perl itself.
perl v5.18.2 2014-01-05 DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server(3)