Sponsored Content
Top Forums Shell Programming and Scripting need a shell script to extract the files from source file and check whether those files existonserve Post 302600456 by muraliinfy04 on Tuesday 21st of February 2012 07:43:00 AM
Old 02-21-2012
need a shell script to extract the files from source file and check whether those files existonserve

Hi,
I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is
Code:
# echo $0
-sh

My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether those files exist on the solaris server and if so what is the location they are present.could somebody help on this?

---------- Post updated at 07:43 AM ---------- Previous update was at 06:53 AM ----------

i have used folllowin command to extract files from the source file.
Code:
egrep '(.c |.cxx |.h |.hxx |.sc )' makefile | grep -v '#'>srclst

i am able to direct the out put to srclst file.Now searching command to find the file from teh srclist file and need to check where that file is located on the server

Last edited by Franklin52; 02-22-2012 at 06:00 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to transfer the files from source to target server.

I need to write a shell script to transfer the files every hour from source - target server. The cron job should be running every hour and shouldn't copy already copied files to the remote server ? I was able to write intial script but not able to get the logic for (in the next run it should... (12 Replies)
Discussion started by: radhirk
12 Replies

2. Shell Programming and Scripting

HOW TO CHECK ONLY .C FILES EXISTS OR NOT IN A FOLDER using IF in C shell script?

Hi friends.. I hav a problem.... I dont know how to check .c files exists r not in a folder using IF in C shell script actually i tried like this if(=~ *.c) even though some .c files or there in the current folder..it is not entering int o the if control statement...... (17 Replies)
Discussion started by: p.hemadrireddy
17 Replies

3. Shell Programming and Scripting

Shell script to check the files hourly and purge

I'm new to shell scripting... i have been given a task.. can any one help in this regard.... 1) Check hourly for files in <destination-path><destination-file-template><destination-file-suffix> for files older than <destination-file-retention> days and purge. It should then check... (1 Reply)
Discussion started by: satishpabba
1 Replies

4. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

5. Shell Programming and Scripting

shell script to take input from a text file and perform check on each servers and copy files

HI all, I want to script where all the server names will be in a text file like server1 server2 server3 . and the script should take servernames from a text file and perform copy of files if the files are not present on those servers.after which it should take next servername till the end of... (0 Replies)
Discussion started by: joseph.dmello
0 Replies

6. Shell Programming and Scripting

Shell script to check files if exist else touch the file

Hi All, Thanks in Advance I wrote the following code if then echo "version is 1.1" for i in "subscriber promplan mapping dedicatedaccount faflistSub faflistAcc accumulator pam_account" do FILE="SDP_DUMP_$i.csv" echo "$FILE" ... (5 Replies)
Discussion started by: aealexanderraj
5 Replies

7. Shell Programming and Scripting

How to check whether directory has files in it or not in shell script?

hi, I am having script in which i want to check if directory has any file in it or not. If directory contains a single or more files then and only then it should proceed to further operations... P.S.: Directory might have thousand number of files. so there might be chance of getting error... (4 Replies)
Discussion started by: VSom007
4 Replies

8. Shell Programming and Scripting

Standardization of input source data files using shell script

Hi there, I'm a newbie in unix and am fishing for options related to how raw input data files are handled. The scenario, as I'm sure y'all must be very familiar with, is this : we receive upwards of 50 data files in ASCII format from various source systems - now each file has its own structure... (3 Replies)
Discussion started by: Prat Khos
3 Replies

9. Shell Programming and Scripting

Shell/perl script to check for files

Hi, I am trying to write a script for following scenario: I have a list of countries from where I receive files...eg. (Indonesia, Thailand, Australia...etc) For each country, I have a list of files that they send. IND -- a,b,c TH -- p,q,r AU -- x,y,z The path for these files could... (2 Replies)
Discussion started by: neil.k
2 Replies

10. Shell Programming and Scripting

Shell script to check a file and delete old files

Hello, I needed help with a shell script where in it checks if a file exists under a directory and also checks the age of the file and delete it if it is older than 3 weeks. thanks (10 Replies)
Discussion started by: hasn318
10 Replies
mkmf(1) 						      General Commands Manual							   mkmf(1)

NAME
mkmf - make a makefile SYNOPSIS
makefile] template] language] [macroname=value ...] DESCRIPTION
The command creates a makefile that informs the command how to construct and maintain programs and libraries (see make(1)). After gather- ing up all source code file names in the current working directory and inserting them into the makefile, scans source code files for included files and generates dependency information that is appended to the makefile. Source code files are identified by their file name suffixes. recognizes the following suffixes: C C++ FORTRAN Include files Pascal include files Lex or Lisp Object files Pascal Ratfor Assembler Yacc The command checks for an existing makefile before creating one. If no option is present, tries the makefiles and respectively. After the makefile has been created, arbitrary changes can be made using a text editor. can also be used to re-edit the macro definitions in the makefile, regardless of changes that may have been made since it was created. By default, creates a program makefile. To create a makefile that handles libraries, the option must be used. Make Requests Given a makefile created by recognizes the following requests: Compile and load a program or library. Remove all object and core files. Remove all files that can be regenerated. Update included file dependencies in a makefile. List the names of the source code files on standard output. Extract all object files from the library and place them in the same directory as the source code files. The library is not altered. Print an index of functions on standard output. Compile and load the program or library and move it to its destination directory. Print source code files on standard output. Create a tags file for the editor (see ex(1) and ctags(1)), for C, Pascal, and Fortran source code files. Recompile only if there are source code files that are newer than the program or library, link and install the program or library. Several requests can be given simultaneously. For example, to (1) compile and link a program, (2) move the program to its destination directory, and (3) remove any unnecessary object files, use: Macro Definitions understands the following macro definitions: C compiler flags. After searching for included files in the directory currently being processed, searches in directories named in com- piler options and then in the directory. Location of If the macro or environment variable is defined, searches for included files in instead of C++ compiler flags. After searching for included files in the directory currently being processed, searches in directories named in com- piler options and then in the directory, followed by the directory. Directory where the program or library is to be installed. List of included files external to the current directory. automatically updates this macro definition in the makefile if dependency information is being generated. Fortran compiler flags. After searching for included files in the directory currently being processed, searches in directories named in com- piler options, then in the directory. List of included files in the current directory. automatically updates this macro definition in the makefile. Installation program name. Link editor name. Link editor flags. Library name. This macro also implies the option. List of libraries needed by the link editor to resolve external references. Makefile name. List of object files. automatically updates this macro definition in the makefile. Program name. List of source code files. automatically updates this macro definition in the makefile. List of additional file name suffixes for to know about. List of included files found in the directory hierarchy. automatically updates this macro definition in the makefile if dependency information is being generated. If is omitted from the makefile, does not generate dependencies. Both these and any other macro definitions already within the makefile can be replaced by definitions on the command line in the form For example, to change the C compiler flags and the program name, type the following line: Note that macro definitions such as with blanks in them must be enclosed in double quote (") marks. Environment The environment is read by All variables are assumed to be macro definitions with the exception of and Environment variables are processed after command line macro definitions and the macro definitions in a makefile. The option forces the environment to override the macro def- initions in a makefile. File Name Suffixes can recognize additional file name suffixes, or ignore ones that it already recognizes, by specifying suffix descriptions in the macro def- inition. Each suffix description takes the form where t is a character indicating the contents of the file = source file, = object file, = header file, = executable file) and I is an optional character indicating the include syntax for header files = C syntax, = C syntax plus the addition of as a standard search directory, = Fortran and Ratfor syntax, = Pascal syntax). The following list shows the default con- figuration for C C++ Fortran Include files Pascal include files Lex or Lisp Object files Pascal Ratfor Assembler Yacc For example, to change the object file suffix to undefine the Pascal include file suffix, and prevent Fortran files from being scanned for included files, the macro definition could be: Include Statement Syntax The syntax of include statements for C, C++, Fortran, and Pascal source code are of the form: C/C++: where must be the first character in the line. Fortran: where must be the first character in the line. Alternatively, the can be omitted if the include statement starts in column 7. In either case the trailing can be omitted. Pascal: where must be the first character in the line and the trailing is optional. User-defined Templates If cannot find a makefile within the current directory, it normally uses one of the standard makefile templates, or in unless the user has alternative or template files in a directory where is the absolute path name of the directory assigned to the environment variable. Options recognizes the following options: Include source files beginning with a in the makefile. Suppress `` makefile message. Turn off scanning of source code for files. Old dependency information is left untouched in the makefile. Environment variables override macro definitions within makefiles. Specify an alternative makefile file name. The default file name is Prompt the user for the name of the program or library and the directory where it is to be installed. If a carriage-return is typed in response to each of these queries, assumes that the default program name is or the default library name is and the destination directory is the current directory. Force the makefile to be a library makefile. Specify an alternative makefile template path name. The path name can be relative or absolute. Specify an alternative language-specific makefile template. The default language is C and the corresponding program and library makefile templates are and respectively. looks for these templates in or DIAGNOSTICS
Exit status 0 is normal. Exit status 1 indicates an error. WARNINGS
The name of the makefile is included as a macro definition within the makefile and must be changed if the makefile is renamed. Since executable files are dependent on libraries, standard library abbreviations must be expanded to full path names within the macro def- inition in the makefile. Generated dependency information appears after a line in the makefile beginning with This line must not be removed, nor must any other information be inserted in the makefile below this line. The name of a program or library must not conflict with any predefined target names in a makefile. It is especially important to avoid the the name to prevent from recursively executing itself an infinite number of times. AUTHOR
was developed by the University of California, Berkeley. FILES
Standard program makefile template Standard library makefile template User-defined program makefile template User-defined library makefile template SEE ALSO
ar(1), ctags(1), ld(1), make(1). "Automatic Generation of Make Dependencies", Walden, K., vol. 14, no. 6, pp. 575-585, June 1984. mkmf(1)
All times are GMT -4. The time now is 08:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy