Some sample data would help as the inverse complex pattern is beyond my imagination. What's your shell / version? Your files have leading dots? I guess <FiileName> is a typo?
Which AIX version are you running? It might make a difference.
Are these conditions to be AND-ed together or OR-ed together? Please be specific else we might go the wrong way about this. As RudiC mentions, it would be better to know what to positively look for rather than try to strip out the unwanted.
Perhaps (depending on the size of the file list being processed) you could use these tests to build a list of files that you want to exclude and then use something like grep -vfF remove_these main_file_list > wanted_file_list to get you close, but if the remove list gets large then results can be less predictable and slow. It would cost processing and IO to go this long way round, but it's possible if there is not better logic to positively select what you want to report.
The easiest way to get your actual output file when you have a list of names may be something like:-
Of course, there may be a better way to blend it into a single operation, saving the processing and IO cost, but you need to help us understand the context. Some examples would be good.
I hope that this helps,
Robin
These 2 Users Gave Thanks to rbatte1 For This Post:
Should you run a recent shell (bash, ksh) that provides "extended globbing" of "pattern-lists", you might use this to feed into rbatte1's awk proposal:
I have made minor change to the pattern as well as corrected the typo on the output file and also included sample filenames and the expected output file.
If a filename does NOT match the below pattern and if any of the FileNames contain spaces in them then write an OUTPUT xml file with the FileNames in the below xml format
FileNames
OutputFile
This User Gave Thanks to techedipro For This Post:
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Hi All,
I am working on designing the archival process for my system, where I will have to find distinct file names ( when excluded time_stamp extention ) from given directory and for each file type keep the latest and move all other older to different location ( lets say dir Back ). Below are... (2 Replies)
Im using the command below , but thats not the output that i want. it only prints the odd and even numbers.
awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}'
Im hoping for something like this
file1:
Text hi this is just a test
text1 text2 text3 text4 text5 text6
Text hi... (2 Replies)
Ive used this snippet of code on a solaris box thousands of times.
But it isnt working on the new linux box
sed -n '/interface LoopBack0/{N;/ ip address /p;}' *.conf
its driving me nuts !!
Is there something Im missing ? (7 Replies)
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Hello Guyz
I have been following this forum for a while and the solutions provided are super useful. I currently have a scenario where i need to search for a pattern and start searching by keeping the first pattern as a baseline
ABC
DEF
LMN
EFG
HIJ
LMN
OPQ
In the above text i need to... (8 Replies)
I guess by "pattern," I mean something different from how that word is defined in the Linux world. If you take $ to mean a letter (a-z) and # to mean a number (0-9), then the pattern I'm trying to match is as follows:
$$$##-####-###-###.jpg
I'd like to write a script that reads in a list of files... (4 Replies)
Hello,
I am new to Unix scripting, and would like some help with my issue:
I have vairous files having some alphanumeric codes in them e.g.
10000-01
34440TE
34590SR
All these codes are stored in the database, and I need to parse these codes out of these filenames, and match them... (2 Replies)