Sponsored Content
Top Forums Shell Programming and Scripting Replacing white spaces in filename Post 302540744 by ajaypadvi on Thursday 21st of July 2011 01:07:29 PM
Old 07-21-2011
Replacing white spaces in filename

Hi;
In following code
Code:
find LOG_DIR -type f | while read filename; do echo $filename; done

I want to precede each white space encountered in filename with \ so that when i use $filename for running some commands in do...done,it wont give me an error.

will appreciate ur help in this.
thanks;

Last edited by Scott; 07-21-2011 at 04:07 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

deleting white spaces

How would I delete white spaces in a specified file? Also, I'd like to know what command I would use to take something off a regular expression, and put it onto another. ie. . . . expression1 <take_off> . . . expression2 (put here) . . . Any help would be great, thanks! (10 Replies)
Discussion started by: cary530
10 Replies

2. Shell Programming and Scripting

delete white spaces

hi all... i have the next question: i have a flat file with a lot of records (lines). Each record has 10 fields, which are separated by pipe (|). My problem is what sometimes, in the first record, there are white spaces (no values, nothing) in the beginning of the record, like this: ws ws... (2 Replies)
Discussion started by: DebianJ
2 Replies

3. Shell Programming and Scripting

Trim white spaces using awk

Hi, I have a CSV file with footer information as below. The third value is the number of records in the file. Sometimes it contains both leading and trailing white spaces which i want to trim using awk. C,FOOTER , 00000642 C,FOOTER , 00000707 C, FOOTER,... (2 Replies)
Discussion started by: mona
2 Replies

4. Shell Programming and Scripting

trimming white spaces

I have a variable that calls in a string from txt file. Problem is the string comes with an abundance of white spaces trailing it. Is there any easy way to trim the tailing white spaces off at the end? Thanks in advance. (9 Replies)
Discussion started by: briskbaby
9 Replies

5. Shell Programming and Scripting

Two or more white spaces in string

Hi, Can anybody suggest me how to combine two strings with two or more white spaces and assign it to a variable? E.g. first=HAI second=HELLO third="$first $second" # appending strings with more than one white spaces echo $third this would print HAI HELLO Output appears... (2 Replies)
Discussion started by: harish_oty
2 Replies

6. Shell Programming and Scripting

white spaces in bash autocompletion

Hello dear community! I've recently written a BASH function for auto completion of options. It works like following: if a user types a command and then an argument to this command which starts with "^-" and then presses TAB, then 'user_command --help (or -h)' is invoked and possible options are... (0 Replies)
Discussion started by: sidorenko
0 Replies

7. Shell Programming and Scripting

Help with sed and replacing white spaces with commas

Dear all, I am in a bit of a quandary. I have 400 text files which I need to edit and output in a very specific way. Here is a sample text file copied from gedit ... The columns will come out a bit messed up but when I cat <file>, it gives a table with six columns (0-28, tot lob vol, vcsf,... (6 Replies)
Discussion started by: antonz
6 Replies

8. UNIX for Dummies Questions & Answers

handling white spaces with getopt

Hi I'm trying to ensure that I have catered for all situations with my getopt cases. One other situation I want to cover is should the user enter the script without any preceding arguments eg: ./script_eg I need the script to the direct the user to the helpfile I have tried... (3 Replies)
Discussion started by: ladyAnne
3 Replies

9. Shell Programming and Scripting

Leading white spaces

Hi, I am having problem in deleting the leading spaces:- cat x.csv baseball,NULL,8798765,Most played baseball,NULL,8928192,Most played baseball,NULL,5678945,Most played cricket,NOTNULL,125782,Usually played cricket,NOTNULL,678921,Usually played $ nawk 'BEGIN{FS=","}!a... (2 Replies)
Discussion started by: scripter12
2 Replies

10. UNIX for Dummies Questions & Answers

filename with white space

our user creates a text file with a white space on the filename. this same file is transfered to unix via automation tool. i have a korn shell script that reads these files on a input directory and connects to oracle database to run the oracle procedures which will load the data from each of the... (2 Replies)
Discussion started by: wtolentino
2 Replies
GENDERS_LOAD_DATA(3)						    LIBGENDERS						      GENDERS_LOAD_DATA(3)

NAME
genders_load_data - read and parse a genders file SYNOPSIS
#include <genders.h> int genders_load_data(genders_t handle, const char *filename); DESCRIPTION
genders_load_data() read and parses the genders file indicated by filename. If filename is NULL, genders_load_data() will attempt to read and parse the default genders file defined by DEFAULT_GENDERS_FILE. handle is a genders handle created by genders_handle_create(3). After genders_load_data() is called, information about the genders file is stored in the genders handle passed in. This information is used by other genders C API functions. All future use of handle with other genders C API functions will be directly associated with the genders file indicated by filename (or the default genders file if filename is NULL). RETURN VALUES
On success, 0 is returned. On error, -1 is returned, and an error code is returned in handle. The error code can be retrieved via gen- ders_errnum(3) , and a description of the error code can be retrieved via genders_strerror(3). Error codes are defined in genders.h. ERRORS
GENDERS_ERR_NULLHANDLE The handle parameter is NULL. The genders handle must be created with genders_handle_create(3). GENDERS_ERR_OPEN The genders file indicated by filename cannot be opened for reading. GENDERS_ERR_READ Error reading the genders file indicated by filename. GENDERS_ERR_PARSE The genders file indicated by filename is incorrectly formatted. GENDERS_ERR_ISLOADED genders_load_data(3) has already been called with handle. GENDERS_ERR_OVERFLOW A line in the genders database exceeds the maximum allowed length. GENDERS_ERR_OUTMEM malloc(3) has failed internally, system is out of memory. GENDERS_ERR_MAGIC handle has an incorrect magic number. handle does not point to a genders handle or handle has been destroyed by genders_han- dle_destroy(3). GENDERS_ERR_INTERNAL An internal system error has occurred. FILES
/usr/include/genders.h SEE ALSO
libgenders(3), genders_handle_create(3), genders_handle_destroy(3), genders_errnum(3), genders_strerror(3) LLNL
August 2003 GENDERS_LOAD_DATA(3)
All times are GMT -4. The time now is 05:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy