Sponsored Content
Top Forums Shell Programming and Scripting Modifying contents of the file in shell script Post 302822801 by anand.shah on Tuesday 18th of June 2013 08:28:38 AM
Old 06-18-2013
Dear Jotne,
When I run "awk" on the output of echo (it's same way you have shown), its working fine for me. But what i want is, whatever is there in echo command is part of file and I want to run "awk" on the file. In this way its not working.
What I want is ....
Code:
awk '/^source/{sub("cfg/config","./non_Profile/app",$0);print}' my_file

where my_file contents
Code:
menu "Application type"
config GUI_TYPE_STANDARD
bool "Standard Application"

source "cfg/config/std.in"
source "cfg/config/cust.in"
source "cfg/config/lang.in"
source "cfg/config/type.in"
endmenu


Last edited by Don Cragun; 06-18-2013 at 09:41 AM.. Reason: Please use CODE tags, not ICODE tags for multi-line chunks of code.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Modifying a csv file from Shell Script

Hi all, I have some script that creates a temp csv file. What I need to do is do some search and replace and modify the file from my shell script. I know the commands to open the file and then apply the reg ex but wasnt sure how I could do this from a script and modify the file? Any help... (2 Replies)
Discussion started by: not4google
2 Replies

2. Shell Programming and Scripting

search for the contents in many file and print that file using shell script

hello have a file1 H87I Y788O T347U J23U and file2 J23U U887Y I99U T556U file3 I99O J99T F557J file4 N99I T666U R55Y file5 H87I T347U file6 H77U R556Y E44T file7 Y788O K98U H8I May be using script we can use file1 to search for all the files and have the output H87I file5... (3 Replies)
Discussion started by: cdfd123
3 Replies

3. Shell Programming and Scripting

Unix shell script to parse the contents of comma-separated file

Dear All, I have a comma-separated file. 1. The first line of the file(header) should have 4 commas(5 fields). 2. The last line of the file should have 1 comma(2 fields). Pls help me in checking this condition in a shell script. And the number of lines between the first line and last... (11 Replies)
Discussion started by: KrishnaSaran
11 Replies

4. Shell Programming and Scripting

update file contents using shell script

Hi, I am having a file which contains as below Names(aaaa ,bbbb ,cccc ,dddd) now i want the file to be updated with new value 'eeee' as below Names(aaaa ,bbbb ,cccc ,dddd ,eeee) Is there a way to script this ? Thanks, (5 Replies)
Discussion started by: drams
5 Replies

5. Shell Programming and Scripting

Shell script for converting file contents into CSV

Hi, I am new in unix, I just want to replace some values from text file according to column numbers. Like, I am having a table as given below: val1 val2 val3 val4 val5 val6 val7 val8 val9 val10 val11 val12 val13 Now i want... (5 Replies)
Discussion started by: rish_max
5 Replies

6. Shell Programming and Scripting

Removing the entire file contents using unix shell script.

I need to remove the entire file contents in file using the shell script. Actually the grap -v command will create one more file and it occupy the space also. I need to remove the entire file contents without creating new file using the shell scripting. Please help me. (5 Replies)
Discussion started by: praka
5 Replies

7. Shell Programming and Scripting

shell script to compare file contents

Hello Has anyone got an example shell script that I can use to compare the contents of two files. The files should contain the same contents, eg. file1.txt apple pear grape file2.txt apple pear grape (2 Replies)
Discussion started by: deedaz
2 Replies

8. Solaris

Modifying the contents of a file and saving it

I have a file with the following content: -------------------- SQL> @DBmonitor_WMHA_SQL_script.sql; Tablespace Size (GB) Free (GB) % Free % Used ------------------------------ ---------- ---------- ---------- ---------- WMHAIT_IS ... (8 Replies)
Discussion started by: Avik Datta
8 Replies

9. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

10. UNIX for Beginners Questions & Answers

Shell Script to Read the given file contents into a merged one file

Like to have shell script to Read the given file contents into a merged one file with header of path+file name followed by file contents into a single output file. While reading and merging the file contents into a single file, Like to keep the format of the source file. ... (4 Replies)
Discussion started by: Siva SQL
4 Replies
CGI::Application::Standard::Config(3pm) 		User Contributed Perl Documentation		   CGI::Application::Standard::Config(3pm)

Last updated:  Sat Feb 18 23:42:29 EST 2006

NAME
CGI::Application::Standard::Config -- Define a standard configuration API for CGI::Application RATIONALE
This module defines a minimum standard interface that configuration plugins for CGI::Application should meet. Having such a standard allows other plugin authors to rely on basic configuration functionality without coding exceptions for several configuration modules, or giving up on such integration. SYNOPSIS
For Average Users Simply load the config plugin before other modules that might use it: use CGI::Application::Plugin::ConfigAuto; use CGI::Application::Plugin::Session; For Configuration plugin authors Configuration plugin authors only need to follow the standards documented below. For other plugin authors who wish to rely on the standard Plugin authors who want to possibly use this standard can do so by simply using this module: package CGI::Application::Plugin::Session; use CGI::Application::Standard::Config; If a standards complaint config module hasn't already been loaded a stub for config() will be added which will safely return "undef". Example use by another plugin Here code first tries to get configuration details first from a config file, then from options passed to a plugin-specific config method, and finally applies defaults if no configuration options are found. my $session_options = $self->config('Session_options') || $self->session_config() || $self->session_defaults; Standard Interface Definition The following defines a minimum standard for configuration plugins to meet. Config plugins are free to provide to additional functionality. Configuration plugins are also encourage to explicity document that they are using "CGI::Application::Standard::Config". If there are existing methods that follow the standard but have different names, you can use this example to always export your method: sub import { my $app = caller; no strict 'refs'; my $full_name = $app . '::config'; # Change cfg to your config()-compliant method name *$full_name = &cfg; CGI::Application::Plugin::YourNameHere->export_to_level(1,@_); } $self->std_config This method should be exported by default to simply declare that you meet the standard report which version of the standard you meet. This simple implementation is recommended: sub std_config { return 1; } $self->config The intended use is to load to read-only configuration details once from a config file at start up time. This service is provided by plugins (list below). They must support at at least this syntax: my $value = $self->config('key'); By default, "config()" simply returns undef, making it safe for other plugins to directly to check if "$self-"config('key')> returns the value it needs. config() must be exported by default. For applications that need little configuration, config() is not necessary-- using "PARAMS" in an instance script should suffice. Also, the "param()" is the appropriate method to use to set a configuration value at run time. Configuration plugins that provide at least this basic API include: CGI::Application::Plugin::ConfigAuto. Standard config variables Users are encouraged to use these standard config variable names, to ease compatibility between plugins: ROOT_URI - A URI corresponding to the project root (http://foo.com/proj ) ROOT_DIR - a file system path to the same location ( /home/joe/www/proj ) All-caps are used to denote that config variables are essentially global constants. Why URI and not URL? The wikipedia explains: The contemporary point of view among the working group that oversees URIs is that the terms URL and URN are context-dependent aspects of URI and rarely need to be distinguished. Furthermore, the term URL is increasingly becoming obsolete, as it is rarely necessary to differentiate between URLs and URIs, in general. Standard Version This is 1.0 of the CGI::Application config() standard. AUTHOR
Written by Mark Stosberg <mark@summersault.com> with input from the CGI::Application community. COPYRIGHT and LICENSE Copyright (C) 2008, Mark Stosberg. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2011-06-25 CGI::Application::Standard::Config(3pm)
All times are GMT -4. The time now is 05:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy