Sponsored Content
Top Forums Shell Programming and Scripting ksh :: want to cut the strings Post 302227463 by rollthecoin on Thursday 21st of August 2008 09:13:29 AM
Old 08-21-2008
i substituted the value for tea.

how to give the command with $tea?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh - strings

Hi, I want to assign a string to a variable as below a="test " and use 'a' in grep grep $a .. when i tried this it was not taking the blank character in string a. how can represent blank space or blank character please help me thanks venkat (1 Reply)
Discussion started by: itzcoolbuddy
1 Replies

2. Shell Programming and Scripting

mailx: concatenating strings for message body (KSH)

Hi all, Think this is a pretty simple problem, but I've been thinking about it for a few days. Let's say that I'm going to have to output the contents of a file as the body of a mailx message. I'll probably do this: cat <filename> | mailx <extra commands> However, how do I go about doing... (1 Reply)
Discussion started by: rockysfr
1 Replies

3. Shell Programming and Scripting

Need to cut filename in LINUX ksh

Hi, I need to cut filename in Linux ksh. for example file name is c_xxxx_cp_200908175035.zip. I need to get variable with only c_xxxx_cp value. (10 Replies)
Discussion started by: juliyp
10 Replies

4. Shell Programming and Scripting

ksh + isql => output cut at 2 GB

Using a ksh script, I'm dumping the data from our sybase database into an output file. This output file is for what ever reason cut at 2GB. There is enough space on the unix machine and as there is no error message is received I have no clue to start looking for a solution. #!... (1 Reply)
Discussion started by: bereman
1 Replies

5. Shell Programming and Scripting

ksh cut out words from string

Hi, I have: export string1=qwerWhatever export string2=qwerWhatever1 export currdir=`pwd` echo $currdir gives back: /dir/dir/Whatever1 I want to take first 4 letters from string1 (in this case: qwer), compare it to string2 (in this case qwerWhatever1) and if string2 has in it... (8 Replies)
Discussion started by: chish
8 Replies

6. Shell Programming and Scripting

How to preserve space while concatenating strings? (KSH)

I have these str1=$(echo "This is string one with spaces \n This is also my sentence 1") When I echo $str1, it displays the new line character properly. Now I have another new variable say str2. I want to concatenate in this way.. str1 + newline character + and then str2. That's I... (3 Replies)
Discussion started by: dahlia84
3 Replies

7. Shell Programming and Scripting

KSH Script to watch log files for 2 strings

Hi all, How can I do a ksh script to watch a log file for 2 specific alarms that have one this string : "Connection Error" and the other one: "Failure in sending". I would like to watch for these two alarms in the log and then if each of them repeats for about 30 times to go kill 2 processes. ... (1 Reply)
Discussion started by: Pouchie1
1 Replies

8. Shell Programming and Scripting

ksh: how to extract strings from each line based on a condition

Hi , I'm a newbie.Never worked on Unix before. I want a shell script to perform the following: I want to extract strings from each line ,based on the type of line(Nameline,Subline) and output it to another file.Below is a sample format. 2010-12-21 14:00"1"Nameline"Midterm"First Name:Jane ... (4 Replies)
Discussion started by: angie1234
4 Replies

9. Shell Programming and Scripting

Cut the strings from end

could you please help me. I have below autosys jobs 01_enable_input_hol_dtpz1b 01_abc_copy_ld_sat_xxxz1 01_abc_mavcd_yyyyyxxxz1 01_abcdef_oa_xxxxxz1 01_fdgte_symbol_ddddz1 01_fsdfsd_clean_mmmhhhfz1 01_fsdfd_create_mut_marchtz1 I want to remove name after last "_" underscore so that... (6 Replies)
Discussion started by: sdosanjh
6 Replies

10. UNIX for Advanced & Expert Users

Cut a word between two strings and repeat the same in the entire file

in the below data i need to search for the word typeMismatch and then traverse back to find the filename of that particular mismatch. Like this we have to get all the file names which has error in them. How can i acheive this. I tried use sed or awk but not able to achevie the same. Sample... (2 Replies)
Discussion started by: ATWC
2 Replies
AppConfig::File(3pm)					User Contributed Perl Documentation				      AppConfig::File(3pm)

NAME
AppConfig::File - Perl5 module for reading configuration files. SYNOPSIS
use AppConfig::File; my $state = AppConfig::State->new(\%cfg1); my $cfgfile = AppConfig::File->new($state, $file); $cfgfile->parse($file); # read config file OVERVIEW
AppConfig::File is a Perl5 module which reads configuration files and use the contents therein to update variable values in an AppConfig::State object. AppConfig::File is distributed as part of the AppConfig bundle. DESCRIPTION
USING THE AppConfig::File MODULE To import and use the AppConfig::File module the following line should appear in your Perl script: use AppConfig::File; AppConfig::File is used automatically if you use the AppConfig module and create an AppConfig::File object through the file() method. AppConfig::File is implemented using object-oriented methods. A new AppConfig::File object is created and initialised using the AppConfig::File->new() method. This returns a reference to a new AppConfig::File object. A reference to an AppConfig::State object should be passed in as the first parameter: my $state = AppConfig::State->new(); my $cfgfile = AppConfig::File->new($state); This will create and return a reference to a new AppConfig::File object. READING CONFIGURATION FILES The "parse()" method is used to read a configuration file and have the contents update the STATE accordingly. $cfgfile->parse($file); Multiple files maye be specified and will be read in turn. $cfgfile->parse($file1, $file2, $file3); The method will return an undef value if it encounters any errors opening the files. It will return immediately without processing any further files. By default, the PEDANTIC option in the AppConfig::State object, $self->{ STATE }, is turned off and any parsing errors (invalid variables, unvalidated values, etc) will generated warnings, but not cause the method to return. Having processed all files, the method will return 1 if all files were processed without warning or 0 if one or more warnings were raised. When the PEDANTIC option is turned on, the method generates a warning and immediately returns a value of 0 as soon as it encounters any parsing error. Variables values in the configuration files may be expanded depending on the value of their EXPAND option, as determined from the App::State object. See AppConfig::State for more information on variable expansion. CONFIGURATION FILE FORMAT A configuration file may contain blank lines and comments which are ignored. Comments begin with a '#' as the first character on a line or following one or more whitespace tokens, and continue to the end of the line. # this is a comment foo = bar # so is this url = index.html#hello # this too, but not the '#welcome' Notice how the '#welcome' part of the URL is not treated as a comment because a whitespace character doesn't precede it. Long lines can be continued onto the next line by ending the first line with a ''. callsign = alpha bravo camel delta echo foxtrot golf hipowls india juliet kilo llama mike november oscar papa quebec romeo sierra tango umbrella victor whiskey x-ray yankee zebra Variables that are simple flags and do not expect an argument (ARGCOUNT = ARGCOUNT_NONE) can be specified without any value. They will be set with the value 1, with any value explicitly specified (except "0" and "off") being ignored. The variable may also be specified with a "no" prefix to implicitly set the variable to 0. verbose # on(1) verbose = 1 # on(1) verbose = 0 # off(0) verbose off # off(0) verbose on # on(1) verbose mumble # on(1) noverbose # off(0) Variables that expect an argument (ARGCOUNT = ARGCOUNT_ONE) will be set to whatever follows the variable name, up to the end of the current line. An equals sign may be inserted between the variable and value for clarity. room = /home/kitchen room /home/bedroom Each subsequent re-definition of the variable value overwrites the previous value. print $config->room(); # prints "/home/bedroom" Variables may be defined to accept multiple values (ARGCOUNT = ARGCOUNT_LIST). Each subsequent definition of the variable adds the value to the list of previously set values for the variable. drink = coffee drink = tea A reference to a list of values is returned when the variable is requested. my $beverages = $config->drinks(); print join(", ", @$beverages); # prints "coffee, tea" Variables may also be defined as hash lists (ARGCOUNT = ARGCOUNT_HASH). Each subsequent definition creates a new key and value in the hash array. alias l="ls -CF" alias h="history" A reference to the hash is returned when the variable is requested. my $aliases = $config->alias(); foreach my $k (keys %$aliases) { print "$k => $aliases->{ $k } "; } A large chunk of text can be defined using Perl's "heredoc" quoting style. scalar = <<BOUNDARY_STRING line 1 line 2: Space/linebreaks within a HERE document are kept. line 3: The last linebreak ( ) is stripped. BOUNDARY_STRING hash key1 = <<'FOO' * Quotes (['"]) around the boundary string are simply ignored. * Whether the variables in HERE document are expanded depends on the EXPAND option of the variable or global setting. FOO hash = key2 = <<"_bar_" Text within HERE document are kept as is. # comments are treated as a normal text. The same applies to line continuation. _bar_ Note that you cannot use HERE document as a key in a hash or a name of a variable. The '-' prefix can be used to reset a variable to its default value and the '+' prefix can be used to set it to 1 -verbose +debug Variable, environment variable and tilde (home directory) expansions Variable values may contain references to other AppConfig variables, environment variables and/or users' home directories. These will be expanded depending on the EXPAND value for each variable or the GLOBAL EXPAND value. Three different expansion types may be applied: bin = ~/bin # expand '~' to home dir if EXPAND_UID tmp = ~abw/tmp # as above, but home dir for user 'abw' perl = $bin/perl # expand value of 'bin' variable if EXPAND_VAR ripl = $(bin)/ripl # as above with explicit parens home = ${HOME} # expand HOME environment var if EXPAND_ENV See AppConfig::State for more information on expanding variable values. The configuration files may have variables arranged in blocks. A block header, consisting of the block name in square brackets, introduces a configuration block. The block name and an underscore are then prefixed to the names of all variables subsequently referenced in that block. The block continues until the next block definition or to the end of the current file. [block1] foo = 10 # block1_foo = 10 [block2] foo = 20 # block2_foo = 20 AUTHOR
Andy Wardley, <abw@wardley.org> COPYRIGHT
Copyright (C) 1997-2007 Andy Wardley. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
AppConfig, AppConfig::State perl v5.12.4 2007-05-30 AppConfig::File(3pm)
All times are GMT -4. The time now is 02:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy