Sponsored Content
Top Forums Shell Programming and Scripting Compare actual files with format Post 302983754 by pointers1234 on Sunday 16th of October 2016 09:48:21 AM
Old 10-16-2016
Compare actual files with format

Hi,

I have database table let say t_filenames which stores filenames and date_format in two columns.

e.g.

Code:
ABCD_TV_YYYYMMDD.txt                  YYYYMMDD
ABCD_MOUSE_YYYYMMDDHHMISS.txt           YYYYMMDDHHMISS

Actual files are available in a directory (say /tmp), actual files are with time/date details.
for e.g.
Code:
ABCD_TV_20160822.txt 
ABCD_MOUSE_20160814062822.txt

I would like to write a script to verify if all the files in the table are available over the directory. If exists create a dummy file if not just exist.

Could you please help me to solve this.

I tried to write a function which connects database and gets the filename and format. As a first step, the format would be replaced with ? marks and then used [[ ]] to verify if the file match. But not much success.



Thank you in advance.

Regards,
Pointers

Last edited by rbatte1; 10-17-2016 at 08:09 AM.. Reason: Added CODE tags for directory list and ICODE tags for important characters being replaced.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Searching list of entries in file for actual files in dir

Hi all, I have a file entries.txt that contains a number of entries all on seperate lines e.g. test1 test2 test3 test4 Then in a directory called /TestFiles I have a number of files that could contain the above text in the file name e.g. qwertytest1.csv qwertytest2.csv... (2 Replies)
Discussion started by: not4google
2 Replies

2. UNIX for Dummies Questions & Answers

compare two text files in a good format

I am writting a script where I have to Campare two text files. I have 3 text files named by s_list, s_list_new and dmg_file. where I have to compare s_list and s_list_new and whatever the unique values are in s_list I have to add that in the dmg_file. And the values they are only in s_list_new... (2 Replies)
Discussion started by: pareshan
2 Replies

3. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

4. Shell Programming and Scripting

awk compare column with date format

I have this code to compare columns 1 and 10 between file1 and file 2 and give me all records that match column 1 but dont match column 10 However column 10 is date format mm/dd/yy and awk cant read it and compare ...i tried awk < file1 -F~ '{print $10}' and it gave blank screen Is... (1 Reply)
Discussion started by: sigh2010
1 Replies

5. Shell Programming and Scripting

Format & Compare two huge CSV files

I have two csv files having 90K records each & each row has around 50 columns.Lets say the file names are FILE1 and FILE2. I have to compare both the files and generate a new file that has rows from FILE2 if it differs. FILE1 ----- 2001,"John",25,19901130,21211.41,Unix Forum... (3 Replies)
Discussion started by: Sheel
3 Replies

6. Shell Programming and Scripting

How to compare the time in different format from a file?

15:09:50.350038 Reading A Data 15:09:50.371645 Reading B Data 15:10:55.655724 Initializing models 15:11:31.320920 Preparing Simulation 15:11:32.763217 Running Calculation 15:15:29.668882 Aggregating Results 15:15:29.950897 Persisting Results How could I make a matrix in H.M.S.MS... (7 Replies)
Discussion started by: manas_ranjan
7 Replies

7. Shell Programming and Scripting

Need script for transferring bulk files from one format to text format

"Help Me" Need script for transferring bulk files from one format to text format in a unix server. Please suggest (2 Replies)
Discussion started by: Kranthi Kumar
2 Replies

8. Shell Programming and Scripting

Perl CGI charts, actual plots and not image files

Does anyone know how to generate CGI charts which are not images , the one I am using generates image files e.g $mygraph3->set( 'x_labels_vertical' => 1 ); $mygraph3->set_legend_font(GD::gdMediumBoldFont); $mygraph3->set_legend('Test Plot'); my $myimage3 = $mygraph3->plot(\@data3)->png;... (4 Replies)
Discussion started by: priyophan
4 Replies

9. Shell Programming and Scripting

How to compare two dates in a specific format ?

Hello, I am not able to find how to compare two dates in '%Y-%m-%d %H:%M:%S,%3N' format i have to two dates as below date1="2016-08-24 09:47:40,444" date2="2016-08-24 10:45:40,567" how to compare these two dates ? I have tried below without success if ; then echo 'yes'; fi ... (6 Replies)
Discussion started by: Ramneekgupta91
6 Replies

10. UNIX for Beginners Questions & Answers

How to get output in mail in actual format?

I need top load memory and cpu uses in mail. I am getting mail, but output is coming in sentence format. can help me, how can I get in actual format. below is the command. echo `ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head`|mailx -r `hostname -s`@abc.com abc@abc.com (5 Replies)
Discussion started by: yash_message
5 Replies
TABS(1) 						    BSD General Commands Manual 						   TABS(1)

NAME
tabs -- set terminal tabs SYNOPSIS
tabs [-n | -a | -a2 | -c | -c2 | -c3 | -f | -p | -s | -u] [+m[n]] [-T type] tabs [-T type] [+[n]] n1[,n2,...] DESCRIPTION
The tabs utility displays a series of characters that clear the hardware terminal tab settings then initialises tab stops at specified posi- tions, and optionally adjusts the margin. In the first synopsis form, the tab stops set depend on the command line options used, and may be one of the predefined formats or at regular intervals. In the second synopsis form, tab stops are set at positions n1, n2, etc. If a position is preceded by a '+', it is relative to the previous position set. No more than 20 positions may be specified. If no tab stops are specified, the ``standard'' UNIX tab width of 8 is used. The options are as follows: -n Set a tab stop every n columns. If n is 0, the tab stops are cleared but no new ones are set. -a Assembler format (columns 1, 10, 16, 36, 72). -a2 Assembler format (columns 1, 10, 16, 40, 72). -c COBOL normal format (columns 1, 8, 12, 16, 20, 55) -c2 COBOL compact format (columns 1, 6, 10, 14, 49) -c3 COBOL compact format (columns 1, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 67). -f FORTRAN format (columns 1, 7, 11, 15, 19, 23). -p PL/1 format (columns 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61). -s SNOBOL format (columns 1, 10, 55). -u Assembler format (columns 1, 12, 20, 44). +m[n], +[n] Set an n character left margin, or 10 if n is omitted. -T type Output escape sequence for the terminal type type. ENVIRONMENT
The LANG, LC_ALL, LC_CTYPE and TERM environment variables affect the execution of tabs as described in environ(7). The -T option overrides the setting of the TERM environment variable. If neither TERM nor the -T option are present, tabs will fail. EXIT STATUS
The tabs utility exits 0 on success, and >0 if an error occurs. SEE ALSO
expand(1), stty(1), tput(1), unexpand(1), termcap(5) STANDARDS
The tabs utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
A tabs utility appeared in PWB UNIX. This implementation was introduced in FreeBSD 5.0. BUGS
The current termcap(5) database does not define the 'ML' (set left soft margin) capability for any terminals. BSD
May 20, 2002 BSD
All times are GMT -4. The time now is 03:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy