List files with spaces in filename


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting List files with spaces in filename
# 1  
Old 08-12-2009
List files with spaces in filename

I have a text file containing files in a directory structure i.e.

Code:
/project/hr/raw/jcpdatav/datav_aug03
/project/hr/raw/jcpdatav/comb8121sep02n
/project/hr/raw/jcpdatav/datav_feb04_ons
/project/hr/raw/jcpdatav/corpsick_jun06
/project/hr/raw/jcpdatav/jcpjoiners200507
/project/hr/raw/jcpdatav/corpsick_jul

Later in the text file some lines appear with spaces, how do I print out only these lines?

Last edited by Franklin52; 08-12-2009 at 10:23 AM.. Reason: adding code tags
# 2  
Old 08-12-2009
Just grep for a space.

Regards
# 3  
Old 08-12-2009
Please use [code] and [/code] tags when posting code, data or logs, ty.
# 4  
Old 08-12-2009
Quote:
Originally Posted by zaxxon
Please use [code] and [/code] tags when posting code, data or logs, ty.
Sorry if it didnt make sense:

Code:
/its/live/permtas/GAPS_rep_source/sesact_funcs.4gl
/its/live/permtas/GAPS_rep_source/fpms.4gl
/its/live/permtas/GAPS_rep_source/april data.txt
/its/live/permtas/GAPS_rep_source/r2l_funcs.4gl

I'm interested in the filenames with spaces.

---------- Post updated at 02:28 PM ---------- Previous update was at 02:26 PM ----------

Quote:
Originally Posted by Franklin52
Just grep for a space.

Regards
Your spot on there, my mind was blank I'de been looking at this for the last hour. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List filename of files only inside a directory (non-recurrsive) on AIX

I wish to list only files along with the absolute path in a given directory on my AiX 6.1 system. Below is the best I could do. ls -p "/app/scripts"/* This gives a a list of all filename along with folder names with absolute path non-recurrsive (without listing files in sub-directories)... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Shell Programming and Scripting

How to list and move files with spaces and wildcard?

I am writing a code that can move and archve all the files in a directory except the latest file based on file pattern provided in a controlfile. The filename is in the form of pattern. So basically we find the all the files of the pattern provided and archive all of them, leaving one latest file.... (3 Replies)
Discussion started by: Saanvi1
3 Replies

3. UNIX for Dummies Questions & Answers

List files after a certain filename

Requirement: I need to ls all files based on date timestamp after a trigger file In the below example, I need to pull only files uploaded after orders.bmk by date timestamp ascending. ORDERS_0000000009877468.txt ORDERS_0000000009877464.txt ORDERS_0000000009877460.txt... (9 Replies)
Discussion started by: eskay
9 Replies

4. Shell Programming and Scripting

Populating a BASH array with a list of files including spaces-in-the-name

For the record, I already tried telling mgmt and the users to disallow spaces in filenames for this script, but it isn't happening for a number of ID10T-error-based reasons. I have simple list of 3 files in a directory that are named like this: bash-3.2$ ls -1 file* file1 file1 part2... (2 Replies)
Discussion started by: ckmehta
2 Replies

5. Shell Programming and Scripting

Creating Multiple data files with spaces in the filename

Hi, I have a list of filenames in the format with Spaces in the filename. As an example : Sample File 1.txt Sample File 2.txt Sample File 3.txt.....I have about 100 files like this. I am trying to create a block of code or use an available command to a) Create a file b) Put in some... (2 Replies)
Discussion started by: ban3rj33
2 Replies

6. UNIX for Dummies Questions & Answers

List of files with spaces

Hi, Anyone can help me on how to list the file with spaces? Like I want to "ls" only the 2008 files. 2008 _overview102.jpg 2008 _overview103.jpg 2008 _overview106.jpg 2008 _overview677.jpg 2008 _overview680.jpg 2008 _overview110.jpg 2008 _overview682.jpg 2009 _overview4373.jpg 2009... (1 Reply)
Discussion started by: fspalero
1 Replies

7. Shell Programming and Scripting

Rename all files (filename with spaces) to different extension

Hi, I have files with filenames as below. SGM Daily Sales Email-en-us-05312012.xlwa I want to rename it in .xls. I am writing a script to change this, as there can be multiple files in subfolders. I have the following script. #!/bin/ksh for oldfile in $(find... (1 Reply)
Discussion started by: mac4rfree
1 Replies

8. UNIX for Dummies Questions & Answers

Copying files with spaces in the filename in a for loop

Hi all, I've been tangoing with this one for a couple of days now and I'm still not making any progress. Basically I'm trying to match three numbers in a string from a text file with matching numbers in a jpeg, and then copying the results to another folder. Data looks like this: Model:... (4 Replies)
Discussion started by: faceonline
4 Replies

9. Shell Programming and Scripting

copying files with spaces in the filename

Hi I am having difficulty copying files from one dir to another due to a space in the names of the file with an extension .rtf There are a group of files and the command am using is cp `ls -rt /wlblive/home/whiops/ops/RTFs/*.rtf|head -20` /wlblive/home/jamshed Since the files are... (3 Replies)
Discussion started by: jamshedj
3 Replies

10. Shell Programming and Scripting

moving files with spaces in filename from one directory to another

Hello, When I run following script #!/bin/bash cd ~/directory1 mv `ls -trF | grep -v / | tail -10 ` ~/directory2 works fine with filenames not having any space but runs into issues with filenames that have spaces tried with $file variable still doesnot work. Can someone help me (4 Replies)
Discussion started by: asakhare
4 Replies
Login or Register to Ask a Question