Sponsored Content
Top Forums Shell Programming and Scripting Compare actual files with format Post 302983755 by RavinderSingh13 on Sunday 16th of October 2016 10:27:29 AM
Old 10-16-2016
Hello pointers1234,

I haven't have a real time scenario so didn't test this code, you could give it a try and let us know how it goes then.
Code:
cat script.ksh
### Here I am taking an example of sql db.
cat << EOF > sql_file.sql
select filenames from t_filenames;
EOF

sqlplus user_name/password@schema_name < sql_file.sql > output_file
#### Here we need to remove junk lines from file output_file which we will get once we connect to client. eg--> connected to: SQL*PLUS version etc.
which I can't predict until/unless you post output for above query with code tags here. So assuming we have removed those lines and have them into a file named output_file_names.
awk '{if($0 !~ /SQL*plus/ && $0 !~ /connected to/){print}}' output_file > output_file_names
while read line
do
	if [[ -f "/tmp/$line" ]]
	then
		echo "File named " $line " is present."
	else
		touch "/tmp/$line"
	fi
done < "output_file_names"

Though there could be more ways to perform this task, one could take this as a startup point.

Thanks,
R. Singh
 

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
SQL::Translator::Schema::View(3pm)			User Contributed Perl Documentation			SQL::Translator::Schema::View(3pm)

NAME
SQL::Translator::Schema::View - SQL::Translator view object SYNOPSIS
use SQL::Translator::Schema::View; my $view = SQL::Translator::Schema::View->new( name => 'foo', # name, required sql => 'select id, name from foo', # SQL for view fields => 'id, name', # field names in view ); DESCRIPTION
"SQL::Translator::Schema::View" is the view object. METHODS
new Object constructor. my $view = SQL::Translator::Schema::View->new; fields Gets and set the fields the constraint is on. Accepts a string, list or arrayref; returns an array or array reference. Will unique the field names and keep them in order by the first occurrence of a field name. $view->fields('id'); $view->fields('id', 'name'); $view->fields( 'id, name' ); $view->fields( [ 'id', 'name' ] ); $view->fields( qw[ id name ] ); my @fields = $view->fields; tables Gets and set the tables the SELECT mentions. Accepts a string, list or arrayref; returns an array or array reference. Will unique the table names and keep them in order by the first occurrence of a field name. $view->tables('foo'); $view->tables('foo', 'bar'); $view->tables( 'foo, bar' ); $view->tables( [ 'foo', 'bar' ] ); $view->tables( qw[ foo bar ] ); my @tables = $view->tables; options Gets and sets a list of options on the view. $view->options('ALGORITHM=UNDEFINED'); my @options = $view->options; is_valid Determine whether the view is valid or not. my $ok = $view->is_valid; name Get or set the view's name. my $name = $view->name('foo'); order Get or set the view's order. my $order = $view->order(3); sql Get or set the view's SQL. my $sql = $view->sql('select * from foo'); schema Get or set the view's schema object. $view->schema( $schema ); my $schema = $view->schema; equals Determines if this view is the same as another my $isIdentical = $view1->equals( $view2 ); AUTHOR
Ken Youens-Clark <kclark@cpan.org>. perl v5.14.2 2012-05-01 SQL::Translator::Schema::View(3pm)
All times are GMT -4. The time now is 09:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy