10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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)
Discussion started by: Ralph
9 Replies
2. Shell Programming and Scripting
I think I must be missing something obvious but I have a file containing a list of files and paths, some with wildcard, others with spaces. e.g.
/this/is/a/file
/this/is/a/directory/
/this/is/a/collection/*
/this/has spaces/in/it
/this/had spaces/and/list/of/files*... (6 Replies)
Discussion started by: mij
6 Replies
3. Shell Programming and Scripting
Hi,
My input files is like this
axis1 0 1 10
axis2 0 1 5
axis1 1 2 -4
axis2 2 3 -3
axis1 3 4 5
axis2 3 4 -1
axis1 4 5 -6
axis2 4 5 1
Now, these are my following tasks
1. Print a first column for every two rows that has the same value followed by a string.
2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies
4. UNIX for Advanced & Expert Users
OS: RHEL 5.8
shell: bash 3.2.25
Directory /home/guest/ contains these files:
file a
file b
file c
fileD
fileE
fileF
testFile.txt
I'm trying to find the syntax to run ls -ltr against this list of files that is contained within a text file, testFile.txt.
The file testFile.txt has... (4 Replies)
Discussion started by: uschaafm
4 Replies
5. Shell Programming and Scripting
I'm somewhat new to BASH scripting but have managed to work my way through most of a problem. I'm trying to get a list of filenames where a column header occurs and any value in that column is within a range.
So far I can sort through the list of files in a directory specified by the user, find... (5 Replies)
Discussion started by: hu_r_u2000
5 Replies
6. Shell Programming and Scripting
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)
Discussion started by: grajp002
7 Replies
7. Shell Programming and Scripting
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)
Discussion started by: Bab00shka
8 Replies
8. Shell Programming and Scripting
Hi,
I want to list all the files matching in a directory directory given below
Here one of the folder has a space in the path.
/MAS02/RMS/WBDev/Krishna/Krishna Mohan/FMSplitByKeyAfterChanges1000075383.fileman.*.txt.out.1000075383.0
The following works from command line... (1 Reply)
Discussion started by: hikrishn
1 Replies
9. Shell Programming and Scripting
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)
Discussion started by: naviztirf
4 Replies
10. Shell Programming and Scripting
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)
Discussion started by: Hitori
4 Replies