Sponsored Content
Top Forums Shell Programming and Scripting help with Scripting - trying to search for string and extract next few characters Post 302487634 by LonJ_80 on Thursday 13th of January 2011 04:46:59 AM
Old 01-13-2011
help with Scripting - trying to search for string and extract next few characters

Hi
I am new to world on unix scripting so any assistance would be gratefully appreciated,
I am trying to write a script which reads through a file, reads in line by line, searches for a pattern, copies string after it and then to do a search and replace elsehwere in the line,

so the input file would readsomething like
Code:
Value1:"alpha" Value2:"beta" Value3:"delta" Value4:"gamma" 
Value1:"bravo" Value2:"charlie" Value3:"echo" Value4:"sierra"

and i would want to extract the value3 from each line i.e "delta" and "echo" and replace Value2 with NewValue:extractedvalue Value2

so after runing the script the file shows
Code:
Value1:"alpha" NewValue:"delta" Value2:"beta" Value3:"delta" Value4:"gamma" 
Value1:"bravo" NewValue:"echo" Value2:"charlie" Value3:"echo" Value4:"sierra"


Moderator's Comments:
Mod Comment Please use code tags when posting data and code samples, thank you!

Last edited by Franklin52; 01-13-2011 at 05:57 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract string between two different characters

I want to extract a string from a line in a text file between two different characters: for example: :string" I want to extract string. It has to be done in a one-liner. (11 Replies)
Discussion started by: rein
11 Replies

2. Shell Programming and Scripting

Search for string in a file and extract another string to a variable

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

3. Shell Programming and Scripting

Extract upper case characters from a string

Hi Friends, I have a script which returns me the following values line by line ora_smon_RCAT102 oracleKHP102B (DESC oraclePROOIDDB92 (DES oraclePMS (DESCRIP oracleBRIO (LOCAL=N oracleBRIO (LOCAL=N oraclePRDB92 (DES oracleBRIO (LOCAL=N oracleBRIO (LOCAL=N oraclePMS (DESCRIP... (4 Replies)
Discussion started by: orakhan
4 Replies

4. Shell Programming and Scripting

Search a String for characters - or +

How would I accomplish this if I want to test to see if it 1) starts with a dash so something like "-R" AND 2) starts with 1 character then either a "-" or "+" and then up to 3 characters such as "a+rx" (3 Replies)
Discussion started by: mkjp2011
3 Replies

5. Shell Programming and Scripting

Extract string between 2 special characters

Hi, I have a unix file with contents as below Line1: ABC MNN X$$QWERTY$$ JKL Line2: HELLO $$HOW$$ ARE $$YOU$$ DOING i want to extract the string between $$ and $$ ie i want the output as QWERTY HOW YOU i want those strings seperated by some character say | desired output is... (7 Replies)
Discussion started by: vinredmac
7 Replies

6. Shell Programming and Scripting

Search String and extract few lines under the searched string

Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed Bold letters are the stations . The whole file has multiple stations . Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

7. Shell Programming and Scripting

To Search for a string and to extract the string from the text

Hi Team I have an huge xml where i need to search for a ceratin numbers. For example 2014-05-06 15:15:41,498 INFO WebContainer : 10 CommonServicesLogs - CleansingTriggerService.invokeCleansingService Entered PUBSUB NOTIFY MESSAGE () - <?xml version="1.0" encoding="UTF-8"... (5 Replies)
Discussion started by: Kannannair
5 Replies

8. UNIX for Dummies Questions & Answers

Extract string between two special characters

Hi, I have a file that looks something like >1-18*anc... (12 Replies)
Discussion started by: jyu429
12 Replies

9. Shell Programming and Scripting

Need to extract characters between two search words in a script!!

Hi, I have a log file which is the output from a xml script : <?xml version="1.0" ?> <!DOCTYPE svc_result SYSTEM "MLP_SVC_RESULT_320.DTD"> <svc_result ver="3.2.0"> <slia ver="3.0.0"> <pos> <msid type="MSISDN" enc="ASC">8093078040</msid> <poserr> ... (4 Replies)
Discussion started by: arjunstarz
4 Replies

10. UNIX for Beginners Questions & Answers

Extract characters from a string name

Hi All, I am trying to extract only characters from a string value eg: abcdedg1234.cnf How can I extract only characters abcdedg and assign to a variable. Please help. Thanks (2 Replies)
Discussion started by: abhi_123
2 Replies
MPSCNNSpatialNormalization(3)				 MetalPerformanceShaders.framework			     MPSCNNSpatialNormalization(3)

NAME
MPSCNNSpatialNormalization SYNOPSIS
#import <MPSCNNNormalization.h> Inherits MPSCNNKernel. Instance Methods (nonnull instancetype) - initWithDevice:kernelWidth:kernelHeight: (nullable instancetype) - initWithCoder:device: (nonnull instancetype) - initWithDevice: Properties float alpha float beta float delta NSUInteger kernelWidth NSUInteger kernelHeight Additional Inherited Members Detailed Description This depends on Metal.framework Specifies the spatial normalization filter. The spatial normalization for a feature channel applies the filter over local regions which extend spatially, but are in separate feature channels (i.e., they have shape 1 x kernelWidth x kernelHeight). For each feature channel, the function computes the sum of squares of X inside each rectangle, N2(i,j). It then divides each element of X as follows: Y(i,j) = X(i,j) / (delta + alpha/(kw*kh) * N2(i,j))^beta, where kw and kh are the kernelWidth and the kernelHeight. It is the end-users responsibility to ensure that the combination of the parameters delta and alpha does not result in a situation where the denominator becomes zero - in such situations the resulting pixel-value is undefined. Method Documentation - (nullable instancetype) initWithCoder: (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device NSSecureCoding compatability While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know which device your data is allocated on, we have to guess and may guess incorrectly. To avoid that problem, use initWithCoder:device instead. Parameters: aDecoder The NSCoder subclass with your serialized MPSKernel device The MTLDevice on which to make the MPSKernel Returns: A new MPSKernel object, or nil if failure. Reimplemented from MPSCNNKernel. - (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device Standard init with default properties per filter type Parameters: device The device that the filter will be used on. May not be NULL. Returns: A pointer to the newly initialized object. This will fail, returning nil if the device is not supported. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later. Reimplemented from MPSCNNKernel. - (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(NSUInteger) kernelWidth(NSUInteger) kernelHeight Initialize a spatial normalization filter Parameters: device The device the filter will run on kernelWidth The width of the kernel kernelHeight The height of the kernel Returns: A valid MPSCNNSpatialNormalization object or nil, if failure. NOTE: For now, kernelWidth must be equal to kernelHeight Property Documentation - alpha [read], [write], [nonatomic], [assign] The value of alpha. Default is 1.0. Must be non-negative. - beta [read], [write], [nonatomic], [assign] The value of beta. Default is 5.0 - delta [read], [write], [nonatomic], [assign] The value of delta. Default is 1.0 - kernelHeight [read], [nonatomic], [assign] The height of the filter window - kernelWidth [read], [nonatomic], [assign] The width of the filter window Author Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code. Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSCNNSpatialNormalization(3)
All times are GMT -4. The time now is 05:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy