Sponsored Content
Full Discussion: Wildcard comparison
Top Forums Shell Programming and Scripting Wildcard comparison Post 302082508 by rdudejr on Wednesday 2nd of August 2006 05:01:07 PM
Old 08-02-2006
Wildcard comparison

Just a quick question:

if I want to do a comparison with a wildcard in a shell script, do i just use '*'? Heres what I have:

elif [ $filesystem != /apps* ]; then
continue

but that doesnt evaluate right. It tries to compare against the literal '/apps*' instead of anything that begins with '/apps'
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find wildcard .shtml files in wildcard directories and removing them- How's it done?

I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days... The structure of the paths are like this: /home/domains/www.domain2.com/tgp/ /home/domains/www.domain3.com/tgp/... (1 Reply)
Discussion started by: Neko
1 Replies

2. UNIX for Dummies Questions & Answers

wildcard

what will the cmd below do? ls *.3 1 members mentions that to seek all permutations and combinations of the mp3 extension ill have to use curly braces, {} and not, . what then will do? (13 Replies)
Discussion started by: abhi
13 Replies

3. Shell Programming and Scripting

wildcard

Hi, I have this code to search all "cif" files using wildcard for file in *.cif do grep "Uiso" $file | awk '{ print $3, $4, $5 }' > tet done I get this error "grep: *.cif: No such file or directory" Please where am I going wrong!!! Thank you in advance (6 Replies)
Discussion started by: princessotes
6 Replies

4. Shell Programming and Scripting

if/else comparison with wildcard

This might be a simple answer but I can't for my life figure it out. If I input "bat", how do I get the condition to pick it up with the wild card *at*. #!/bin/bash read -p "enter" BOO if ; then echo "you win" else echo "you lose" fi (3 Replies)
Discussion started by: zerofire123
3 Replies

5. UNIX for Advanced & Expert Users

wildcard help

Can someone please explain the wildcards in this. How is this recursive? When I put this in my terminal it recursively displayed everything. ls .* * (6 Replies)
Discussion started by: cokedude
6 Replies

6. Shell Programming and Scripting

How to use wildcard * in if?

Hi, Can anyone help me how to use * in if statement. File contains below line1:a|b|c|Apple-RED| line2:c|d|e|Apple-Green| line3:f|g|h|Orange| I need to find line by line 4th field contains 'Apple' or not. Please help me at the earliest. (6 Replies)
Discussion started by: jam_prasanna
6 Replies

7. Shell Programming and Scripting

wildcard help!!

i have got heaps of files (.pdf, .txt and .doc) files in one folder, i am making a program in PERL that helps me find the files i want easier using shell wildcard, something like this!! print "Enter a pattern: (must be in )"; $input = <STDIN>; if (The input is in and valid wildcard... (3 Replies)
Discussion started by: bshell_1214
3 Replies

8. Shell Programming and Scripting

Sed Wildcard

Hello, I apologize for asking what is probably a simple question but I have been unable to understand the other posts on the topic. I have a file that has the following several lines: ABC DEF GH:IJKLMNOP_QRS_TUV_11112012_ABCL5 ABC DEF GH:IJKLMNOP_QRS_TUV_11112013_ABCL4 ABC DEF... (4 Replies)
Discussion started by: MolecularToast
4 Replies

9. Shell Programming and Scripting

Wildcard in ls

Hi Experts, I want to use ls in the below form: ls -l *.{txt,TXT} (working fine) but when i am declaring a variable, VAR="*.{txt,TXT}" ls -l $VAR is not working. Please help. Thanks. (4 Replies)
Discussion started by: sugarcane
4 Replies

10. OS X (Apple)

Help with wildcard

CD_numb is AM017 this code: set the_Firstcom_CD to (do shell script "ls -d '/volumes/audioNAS/Firstcom/Access Music/' ") & CD_numb gives me this: "/volumes/audioNAS/Firstcom/Access Music/AM017" the item I am looking for is AM017Q. I can get the "*" syntax right so it never finder... (7 Replies)
Discussion started by: sbrady
7 Replies
fstrcmp(1)						      General Commands Manual							fstrcmp(1)

NAME
fstrcmp - fuzzy comparison of strings SYNOPSIS
fstrcmp [ -p ] first-string second-string fstrcmp -w first-string second-string fstrcmp -a first-file second-file fstrcmp -s needle haystack... fstrcmp --version DESCRIPTION
The fstrcmp command is used to make fuzzy comparisons between strings. The "edit distance" between the strings is printed, with 0.0 mean- ing the strings are utterly un-alike, and 1.0 meaning the strings are identical. You may need to quote the string to insulate them from the shell. OPTIONS
The fstrcmp command understands the following options: -a --files-as-bytes This option is used to compare two files as arrays of bytes. See fmemcmp(3) for more information. -p --pair This option is used to compare two strings as arrays of bytes. This is the default. See fstrcmp(3) for more information. -s --select This option is used to select the closest needle from the provided haystack alternatives. The most similar (single) choice is printed. If none are particularly similar, nothing is printed. See fstrcmp(3) for more information. See below for example. -V --version This option may be used to print the version of the fstrcmp command, and then exit. -w --wide-pair This option is used to compare two multi-byte character strings. See fstrcoll(3) for more information. EXIT STATUS
The fstrcmp command exits with status 1 on any error. The fstrcmp command only exits with status 0 if there are no errors. EXAMPLE
The fstrcmp --select option may be used in a shell script to improve error messages. case "$action" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "$0: action "$action" unknown" 1>&2 guess=`fstrcmp --select "$action" stop start restart` if [ "$guess" ] then echo "$0: did you mean "$guess" instead?" 1>&2 fi exit 1 ;; esac Thus, the error message frequently suggests the correct action in the face of simple finger problems on the command line. SEE ALSO
fstrcmp(3) fuzzy comparison of strings fstrcoll(3) fuzzy comparison of two multi-byte character strings fstrcmpi(3) fuzzy comparison of strings, integer variation COPYRIGHT
fstrcmp version 0.4 Copyright (C) 2009 Peter Miller Peter Miller <pmiller@opensource.org.au> The comparison code is derived from the fuzzy comparison functions in GNU Gettext 0.17. The GNU Gettext comparison functions were, in turn, derived from GNU Diff 2.7. Copyright (C) 1988-2009 Free Software Foundation fstrcmp(1)
All times are GMT -4. The time now is 06:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy