09-23-2010
hi kurumi,
Thanks for ur solution.
I would like to go with sed only, i noticed typo error .sed address pattern shd be $i in my previous post .
still i didnt get the expected output.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, guys. I have one question:
I need to search for a string in a file, and then extract another string from the file and assign it to a variable.
For example:
the contents of the file (group) is below:
...
ftp:x:23:
mail:x:34
...
testing:x:2001
sales:x:2002
development:x:2003
...... (6 Replies)
Discussion started by: daikeyang
6 Replies
2. Shell Programming and Scripting
Hi
I want to read a file line by line and search for a particular string in each line(say for example string containing @ )and save that string into a variable.
Can someone suggest me the way to implement it.I am using K- shell
Thanks
Ishita (5 Replies)
Discussion started by: Ishita
5 Replies
3. Shell Programming and Scripting
Hi,
i call my shell like:
my_shell "my project name"
my script:
#!/bin/bash -vx
projectname=$1
sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp
cp temp test_config_doxy
the following error occurres:
sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies
4. Shell Programming and Scripting
Guys I am having trouble trying to pull some data from a file using a value returned from a for statement. Any help would greatly be apprecaited. I can't seem to get my script to pass the variable. I am trying to pull the 2 lines below the line that has the "pool name" so that i can get the... (5 Replies)
Discussion started by: scottzx7rr
5 Replies
5. Shell Programming and Scripting
Can someone tell me how I can do this?
e.g:
a=$(echo -e wert trewt ertert ertert ertert erttert
erterte
rterter
tertertert
ert)
How do i replace the STRING with $a?
I try this:
sed -i 's/STRING/'"$a"'/g' filename.ext
but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies
6. Shell Programming and Scripting
Hi ,
I have input file like below
Hi this is "vinoth".
Hi happy to work with 'unix'
USA(united states of America)
My script variables are below :
Dquote=Ộ
Squote=&#$567
Obrac=&^986
Cbrac=&^745
I want to read the variables in my SED command to replace the double quote,single... (9 Replies)
Discussion started by: vinothsekark
9 Replies
7. Shell Programming and Scripting
Hi,
I am trying to find a way to get sed/awk/grep to help me find a string in a log file that exists between two datestamps and then print the preceding datestamp up to the next datestamp.
Here is an example of my logfile:
+++ 2013/03/28 17:01:37.085 SIGNALING HIGH ACTIVE
Failure Response... (5 Replies)
Discussion started by: raytx
5 Replies
8. Shell Programming and Scripting
Hi !
I want to search a string in all lines with sed. If that string is there, i want to look for an other string in the next line.If that string is there i want to put an other line under it.
eg:
aaa
bbb
ccc
ddd
cat bla.txt | sed -e '/aaa/a\' -e ' \!!!'
in the upper case, i would... (6 Replies)
Discussion started by: fugitivus
6 Replies
9. Shell Programming and Scripting
Dear all,
I try to replace a string of characters in a file (MyFile.txt) by a multiline value of the variable "Myvar":
$ cat MyFile.txt
DESCRIPTION '@TargetTable SCHEMA'
(
@InputFlowDef
);
$
The content of Myvar:
$ echo "$Myvar"
col1
, col2
, col3
$ (4 Replies)
Discussion started by: dae
4 Replies
10. Shell Programming and Scripting
I'm interested to match column pattern through awk using an external variable for data:
-9 1:751343:T:A -9 0 T A 0.726 -5.408837e-03 9.576603e-03 7.967536e-01 5.722312e-01
-9 1:751756:T:C -9 0 T C 0.727 -5.360458e-03 9.579447e-03 7.966977e-01 5.757858e-01... (7 Replies)
Discussion started by: genome
7 Replies
LEARN ABOUT REDHAT
pdl::autoloader
AutoLoader(3) User Contributed Perl Documentation AutoLoader(3)
NAME
PDL::AutoLoader - MatLab style AutoLoader for PDL
SYNOPSIS
use PDL::AutoLoader;
$a = func1(...); # Load file func1.pdl
$b = func2(...); # Load file func2.pdl
$PDL::AutoLoader::Rescan = 1; # Enable re-scanning
DESCRIPTION
This module implements a MatLab style AutoLoader for PDL. If a unknown function 'func()' is called then a file 'func.pdl' is searched for
and if found is read in to define 'func()' which is then executed.
Files are seached for using the directories in seach path @PDLLIB, which is initialised from the shell environment variable "PDLLIB" which
is a colon seperated list of directories.
e.g. in csh
setenv PDLLIB "/home/kgb/pdllib:/local/pdllib"
Note this is kept seperate from "PERL5LIB" just in case.
As an added bonus, you can use a leading '+' on a directory name to search not just that directory but the entire directory tree under it
(excluding symlinks). The subdirs are determined by explicit search, and searches occur at startup and again each time you change the num-
ber of elements in @PDLLIB.
For example,
setenv PDLLIB "+~kgb/PDL"
will search /home/kgb/PDL and all its subdirectories for .pdl files.
AUTO-SCANNING
The variable $PDL::AutoLoader::Rescan controls whether files are automatically re-scanned for changes at the "perldl" command line.
If "$PDL::AutoLoader::Rescan == 1" and the file is changed then the new definition is reloaded auto-matically before executing the "perldl"
command line. Which means in practice you can edit files, save changes and have "perldl" see the changes automatically.
The default is '0' - i.e. to have this feature disabled.
As this feature is only pertinent to the "perldl" shell it imposes no overhead on PDL scripts. Yes Bob you can have your cake and eat it
too!
Note: files are only re-evaled if they are determined to have been changed according to their date/time stamp.
No doubt this interface could be improved upon some more. :-)
Sample file:
sub foo { # file 'foo.pdl' - define the 'foo' function
my $x=shift;
return sqrt($x**2 + $x**3 + 2);
}
1; # File returns true (i.e. loaded successfully)
AUTHOR
Copyright(C) 1997 Karl Glazebrook (kgb@aaoepp.aao.gov.au); several extensions by Craig DeForest (deforest@boulder.swri.edu) All rights
reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see
the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in
the file.
BUGS
No doubt this interface could be improved upon some more. :-)
Will probably be quite slow if "$PDL::AutoLoader::Rescan == 1" and thousands of functions have been autoloaded.
There could be a race condition in which the file changes while the internal autoloader code is being executed but it should be harmless.
Probably has not been tested enough!
perl v5.8.0 2002-08-06 AutoLoader(3)