Unix Filename Pattern Matching
Looking on how to write Unix shell script for filename pattern matching? There’s several way you can write it using regular expression technique in scripting.
Let’s say you have a scenario where you want to perform certain command execution e.g file processing if certain filename exist in certain folder.
Here’s the example of a simple Unix shell script you can use to accommodate your file processing scenario.
#!/bin/bash V_SOURCE_PATH=/export/home/oracle cd $V_SOURCE_PATH for file in ./*_new.txt ; do if [ -e "$file" ] # Make sure file exists and isn't an empty match then echo "Filename with pattern _new.txt exist" else echo "Filename with pattern _new.txt not exist" fi done
Related Posts
- Unix Directory Permission Checking Script
- AWK Find Match Line Command
- Shell Script Check File Extension Plus Format
- Unix SED command
- Sqlplus EOF In Unix Shell Script
PreviousNext» Oracle SQL Tuning 101
Leave a Comment



