Sponsored Content
Top Forums Shell Programming and Scripting Copy UNIX File into a DSN with a specific Format Post 302834613 by AnjanM on Friday 19th of July 2013 11:13:06 AM
Old 07-19-2013
Lightbulb Copy UNIX File into a DSN with a specific Format

Hi All ,

I am new to programming and here is what i am trying to achieve , i am taking a list of mounted filesystems (based on the HLQ) , passing it on to a txt file and then copying the file to a DSN .The code i am using :

Code:
df | grep WAST.*WASCFG.*ZFS |  awk '{print $2}' | sort -o log.txt | cp  log.txt "//'WAST.PSYSZ.N.WASTZFS1.TDEV'"

The DSN when getting created looks like this this :

Code:
(WAST.PSYSZ.NO**.WASCFG.T****.ZFS)
(WAST.PSYSZ.NO**.WASCFG.T****.ZFS)
(WAST.PSYSZ.NO**.WASCFG.T****.MOUNTPT.ZFS)
(WAST.PSYSZ.NO**.WASCFG.T****.MOUNTPT.ZFS)

the Format (in the DSN) which is required should be :-

Code:
 INCLUDE( -
     WAST.PSYSZ.NO**.WASCFG.T****.ZFS                        -
     WAST.PSYSZ.NO**.WASCFG.T****.ZFS                        -
     WAST.PSYSZ.NO**.WASCFG.T****.MOUNTPT.ZFS                -
     WAST.PSYSZ.NO**.WASCFG.T****.MOUNTPT.ZFS                -
     
      )


Any help would be highly appreciated.

Regards

Last edited by Corona688; 07-19-2013 at 01:21 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash copy file contents into an existing file at a specific location

Hi all I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far: File A line 1 line 2 line 3 line 4 ... (6 Replies)
Discussion started by: gshepherd7
6 Replies

2. Shell Programming and Scripting

Assigning a specific format to a specific column in a text file using awk and printf

Hi, I have the following text file: 8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm 9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm 10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm 11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Discussion started by: goodbenito
2 Replies

3. Shell Programming and Scripting

How to copy specific file.txt in specific folder?

hye there... i have a problem to copy file in specific folder that will change the name according to host,time(%m%s) and date(%Y%M%D) example folder name: host_20100531.154101801 this folder name will always change... but i just want to copy the AAA.txt and BBB.txt file.. really need... (17 Replies)
Discussion started by: annetote
17 Replies

4. Shell Programming and Scripting

How to check for file name of specific format using find?

I have to find the specific formatted file is present in the received list in the directory, for which I have written: file_list=`ls -lrt /tmp/vinay/act/files |grep "$cdate"| awk '{print $9}'` while read fileStr do find $file_list $fileStr > /dev/null status=`echo $?` if ; then ... (3 Replies)
Discussion started by: IND123
3 Replies

5. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

6. Shell Programming and Scripting

How to copy specific files when you don't know the file name?

I hope this isn't as silly as it sounds from the title of the thread. I have software that outputs files where the name starts with a real number followed by underscore as a prefix to an input file name. These will list in the directory with the file with the smallest real number prefix as the... (5 Replies)
Discussion started by: LMHmedchem
5 Replies

7. UNIX for Dummies Questions & Answers

Quick UNIX command to display specific lines in the middle of a file from/to specific word

This could be a really dummy question. I have a log text file. What unix command to extract line from specific string to another specific string. Is it something similar to?: more +/"string" file_name Thanks (4 Replies)
Discussion started by: aku
4 Replies

8. Shell Programming and Scripting

Copy specific file (different but same name) as folder name

I have to copy a particular file present in a main folder having part of the file-name present in many sub-folders to a new destination preserving the name of the source "part of the main folder" and previous file-name of the output file: Example: From /005_0/1000/005.xxx ->... (7 Replies)
Discussion started by: wappor
7 Replies

9. Shell Programming and Scripting

Find and Copy file of specific location

Dear All, I need to transfer all files present in one location to another but those files should be of specific extension like. Find and copy all files of extension .xls, .pdf, .txt from location usr/tmp to location /per/Treat (6 Replies)
Discussion started by: yadavricky
6 Replies

10. AIX

I cannot find dsn and TNSNAMES.ora on UNIX

Where can I find dsn and TNSNAMES.ora on UNIX AIX Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
odbcinst(1)							UnixODBC Reference						       odbcinst(1)

NAME
odbcinst - command line tool for batch ODBC configuration SYNOPSIS
odbcinst action object options action is one of -i install a driver or data source -u uninstall a driver or data source -q query a list of drivers or data sources present on the system --version shows the version number of the program object is one of -d an ODBC driver in /etc/odbcinst.ini -s an ODBC Data Source Name (DSN) in an odbc.ini file. options are zero or more of -f template file Used with -i, this option specifies a template file containing the driver or DSN to be installed. -r Read the template from standard input. -n Driver/Data Source Name Used with -u to specify a driver or DSN to remove. -v Contrary to standard practice, this turns off verbose output; there is no output, even for errors. -l The specified Data Source object is a System DSN, in /etc/odbc.ini. -h The specified Data Source object is a User DSN, in the current user's $HOME/.odbc.ini. This is the default with -s. DESCRIPTION
odbcinst updates the configuration files that control ODBC access to database servers on the current host. It also maintains in /etc/odbcinst.ini a count of the number of references to a particular driver, which can be used to determine whether it should be removed from the file (only when the reference count drops to 0). Installing Drivers and DSNs are installed using the -i option. If the object to be installed is a driver (-d), the specified driver is added to /etc/odbcinst.ini or its reference count is incremented if it is already there. If the object is a data source (-s), the data source is added either to /etc/odbc.ini (if -l is used) or to $HOME/.odbc.ini (the default, which can also be specified with -h). Uninstalling Uninstalling a driver is done with the command odbcinst -u -d -n driver name. Uninstalling a DSN is done with the command odbcinst -u -s -n data source name. Uninstalling causes the reference count on the object to be decremented. If nothing else has requested this driver or DSN (i.e., the reference count drops to zero), it is removed from the config file. The options -l and -h are used with -s to specify which odbc.ini file to configure. Queries The command odbcinst -q -d returns a list of all drivers present in /etc/odbcinst.ini. The command odbcinst -q -s returns a list of all system and user DSNs available. EXIT STATUS
0 Success non-zero Failure TEMPLATE FILES
A typical driver template looks like this: [MySQL] Description = MySQL driver Driver = /usr/lib/odbc/libmyodbc.so Setup = /usr/lib/odbc/libodbcmyS.so A DSN template looks like this: [Sample DSN] Description = Test MySQL connection Driver = MySQL Trace = Yes TraceFile = /tmp/odbc.log Database = junk Server = localhost Port = 3306 Socket = The Description and Driver fields should be present in all DSN configurations. Other options are driver-specific; consult your ODBC driver's documentation for a list of allowed options, or see ODBCConfig(1) for a graphical tool that can be used to interactively set up a DSN or driver the first time. FILES
/etc/odbcinst.ini, /etc/odbc.ini, $HOME/.odbc.ini AUTHOR
This manual page was written by Oliver Elphick <olly@lfix.co.uk> and Steve Langasek <vorlon@debian.org> for the Debian package of unixODBC. SEE ALSO
ODBCConfig(1), gODBCConfig(1) UnixODBC 2nd Mar 2002 odbcinst(1)
All times are GMT -4. The time now is 06:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy