Finding non-existing words in a list of files in a directory and its sub-directories


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding non-existing words in a list of files in a directory and its sub-directories
# 8  
Old 01-12-2016
I created a file called tblfile

And then added the below contents (i.e. comma separated table names).

table_one,table_ten,table_x,table_y,table_z

Last edited by Bhanu Dhulipudi; 01-12-2016 at 09:28 AM..
# 9  
Old 01-12-2016
Works for me (linux, FreeBSD)
Code:
awk -F, '
NR == 1         {for (n=split($0, T); n>0; n--) TBL[T[n]]=n
                 next
                }
$0 in TBL       {delete TBL[$0]
                }
END             {print "non-existing:"
                 for (t in TBL) print t
                }
' tblfile *.java
non-existing:
table_one
table_y
table_z

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

List all files and directories in the current directory separated by commas and sorted by crtime

What I know so far: ls -A will list all files except those starting with a dot ls -d will list all directories ls -m will separate contents by commas For getting crtimes use: stat filename will give me the inode number or ls -i filename will give... (13 Replies)
Discussion started by: chstewar
13 Replies

2. Shell Programming and Scripting

Finding files deep in directories

i need to find a portable way to go through multiple directories to find a file. I've trid something like this: find /opt/oracle/diag/*/alert_HH2.log -printordinarily, i can run the ls command and it will find it: /opt/oracle/diag/*/*/*/*/alert_HH2.log The problem with this approach is... (3 Replies)
Discussion started by: SkySmart
3 Replies

3. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

4. UNIX for Dummies Questions & Answers

[Solved] Finding the Files In the Same Name Directories

Hi, In the Unix Box, I have a situation, where there is folder name called "Projects" and in that i have 20 Folders S1,S2,S3...S20. In each of the Folders S1,S2,S3,...S20 , there is a same name folder named "MP". So Now, I want to get all the files in all the "MP" Folders and write all those... (6 Replies)
Discussion started by: Siva Sankar
6 Replies

5. UNIX for Dummies Questions & Answers

Appending lines from an existing list to each line in another existing list

Evening all ! I would like to ask your expertise on how to accomplish the following ; I have 2 lists, and would like each line from list2 to be appended to each line in list1, resulting in list3 ; List1; alpha beta charlie List2; one two three (4 Replies)
Discussion started by: TAPE
4 Replies

6. UNIX for Dummies Questions & Answers

List directories and sub directories recursively excluding files

Hi, Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process. I wanted to disply using a unix command all the directories recursively excluding files. I tried 'ls -FR' but that display files as... (3 Replies)
Discussion started by: pointers
3 Replies

7. UNIX for Dummies Questions & Answers

Count number of files in directory excluding existing files

Hi, Please let me know how to find out number of files in a directory excluding existing files..The existing file format will be unknown..each time.. Thanks (3 Replies)
Discussion started by: ammu
3 Replies

8. Shell Programming and Scripting

Finding directory and sub-directories individual size in Perl

Hi, Can anyone redirect to an existing thread or provide some info on how to find the size of a directory and it's sub-directories using a single script ? I tried finding a similar thread but in vain. I'm a newbie and any help would be greatly appreciated. Thanks in advance. (3 Replies)
Discussion started by: ryder
3 Replies

9. UNIX for Dummies Questions & Answers

List files that are not directories from current directory

I can't manage to list all files that are not directories from current directory. (2 Replies)
Discussion started by: beni22sof
2 Replies

10. UNIX for Dummies Questions & Answers

finding largest files (not directories)?

hello all. i would like to be able to find the names of all files on a remote machine using ssh. i only want the names of files, not directories so far i'm stuck at "du -a | sort -n" also, is it possible to write them to a file on my machine? i know how to write it to a file on that... (2 Replies)
Discussion started by: user19190989
2 Replies
Login or Register to Ask a Question