Bash snippet to find files based on a text file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash snippet to find files based on a text file?
# 8  
Old 04-02-2009
Quote:
Originally Posted by achellstrom
Those are back ticks on the title variable line. My solution works I have tested it.

Hi,

I dont have access to unix.
Can you please paste what change you made.
And please let me know about any unix emulator i can use on my windows machine
# 9  
Old 04-02-2009
Quote:
Originally Posted by achellstrom
Those are back ticks on the title variable line. My solution works I have tested it.
Sorry, it's not working here. As I said in the first post, it works perfectly from the command line (aside from returning more than 1 match), but in the script, it runs find on each word, instead of each line.
# 10  
Old 04-02-2009
./requested.sh: command substitution: line 23: unexpected EOF while looking for matching `''
Line 23: title="`echo $title|tr '[A-Z]' '[a-z]`"
# 11  
Old 04-02-2009
Quote:
Originally Posted by DJ Charlie
./requested.sh: command substitution: line 23: unexpected EOF while looking for matching `''
Line 23: title="`echo $title|tr '[A-Z]' '[a-z]`"

I think you need to put the movie names in single quotes.
Befor that try echo $title in the script.
If it is splitting then you need to put single quotes on movie names
# 12  
Old 04-02-2009
Echoing the $title shows the full line (song name), not an individual word.

I'm going to move the tr line out of the loop, to see if that helps.
# 13  
Old 04-02-2009
Quote:
Originally Posted by DJ Charlie
./requested.sh: command substitution: line 23: unexpected EOF while looking for matching `''
Line 23: title="`echo $title|tr '[A-Z]' '[a-z]`"

Try this

typeset -u title="`echo $title`"
# 14  
Old 04-02-2009
typeset: -u: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash to move specific files to directory based on match to file

I am trying to mv each of the .vcf files in the variants folder to the folder in /home/cmccabe/f2 that the .vcf id is found in file. $2 in file will always have the id of a .vcf in the variants folder. The line in blue staring with R_2019 in file up to the -v5.6 will always be an exact match to a... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Shell Programming and Scripting

How to find list of missing files based on the file format?

Hi All, In the file names we have dates. Based on the file format given by the user, if any file is not existed for a particular date with in a given interval we should consider that file is missing. I have the below files in the directory /bin/daily/voda_files. ... (9 Replies)
Discussion started by: nalu
9 Replies

3. UNIX for Beginners Questions & Answers

Rename files based on simple text file

Hello! New here although not completely new to Unix. I wonder how I could rename files based on the data found in a simple textfile. It goes like this: I have 4 files 1 ldfgkkfjslkdfjsldkfjsf.wav 2 nndsdflksdjf.wav 3 sdflksjdf jjsdflsdfl.wav 4 dkadsdddd.wav Textfile.txt looks like... (14 Replies)
Discussion started by: Oortone
14 Replies

4. Shell Programming and Scripting

Code snippet to cut XML files based on record length

I want to do FTP an Huge XML file to mainframe server using AIX server Since my file size is huge, i want to split the XML file based on a delimiter , the record delimiter should be set after every 27000 bytes of data and then do the ftp This is done becos the data send to the mainframe must... (1 Reply)
Discussion started by: vishwanath001
1 Replies

5. Shell Programming and Scripting

awk to skip lines find text and add text based on number

I am trying to use awk skip each line with a ## or # and check each line after for STB= and if that value in greater than or = to 0.8, then at the end of line the text "STRAND BIAS" is written in else "GOOD". So in the file of 4 entries attached. awk tried: awk NR > "##"' "#" -F"STB="... (6 Replies)
Discussion started by: cmccabe
6 Replies

6. Shell Programming and Scripting

Rename files based on name in text file

Hello, I have a text file "file.list" with the contents below. file1 filename1 file2 filename2 file3 filename3 file1, file2 and file3 are files existing in the same directory as the text file file.list. I want to rename file1 to filename1, file2 to filename2, as show in the text... (1 Reply)
Discussion started by: james2009
1 Replies

7. Shell Programming and Scripting

Extracting lines from text files in folder based on the numbers in another file

Hello, I have a file ff.txt that looks as follows *ABNA.txt 356 24 36 112 *AC24.txt 457 458 321 2 ABNA.txt and AC24.txt are the files in the folder named foo1. Based on the numbers in the ff.txt file, I want to extract the lines from the corresponding files in the foo1 folder and... (2 Replies)
Discussion started by: mohamad
2 Replies

8. Shell Programming and Scripting

bash script to find date based on search string for continuesly updating file

Hi All, I am very new to UNIX and I have tried this for a longtime now and unable to crack it.... There is a file that is continuously updating. I need to search for the string and find the date @ which it updated every day..... eg: String is "work started" The log entry is as below: ... (1 Reply)
Discussion started by: Nithz
1 Replies

9. Shell Programming and Scripting

Bash script to delete folder based on text file information

I have been working on a script to list all the name's of a subfolder in a text file then edit that text file and then delete the subfolder base on the edited text file so far I have been able to do every thing I just talked about but can't figure out how to delete the subfolers base on a text file... (8 Replies)
Discussion started by: bone11409
8 Replies

10. Shell Programming and Scripting

splitting files based on text in the file

I need to split a file based on certain context inside the file. Is there a unix command that can do this? I have looked into split and csplit but it does not seem like those would work because I need to split this file based on certain text. The file has multiple records and I need to split this... (1 Reply)
Discussion started by: matrix1067
1 Replies
Login or Register to Ask a Question