Sponsored Content
Top Forums Shell Programming and Scripting How to replace part of string? Post 303034381 by green_k on Wednesday 24th of April 2019 09:14:15 AM
Old 04-24-2019
Quote:
Originally Posted by vgersh99
simplified and fixed:
Code:
awk -F= -v var="$new_value" '/ABCD/ {$1= "=" var} 1' file > new_file

ti works. thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using sed to replace a part of string

Hi, I have files that are named front1.txt to front999.txt. They are all in the same directory. To change "front" to "back", I am doing something like this. for file in *.txt; do new=`echo $file | sed 's/^**/back/g'` mv $file $new done My problem is what if files are named... (6 Replies)
Discussion started by: csejl
6 Replies

2. UNIX for Dummies Questions & Answers

regarding replace a part of a string

hi all. i have a file name like abcd_vbnh.a_p i have to copy it as abcd_vbnh.a every time... in unix not in perl please (7 Replies)
Discussion started by: madhu_aqua14
7 Replies

3. UNIX for Dummies Questions & Answers

replace part of single string in a file

hi! i have a file consisting of the following lines: (BTW, = space) . . . 12ME_T1mapping_flip30bshortf 13DCE_whole_brainbshortf 13DCE_3Dbshortf . . . the list of scans starts at 1 and goes on sometimes up to 60 scans. i would like to change only the lines that contain 'whole' to... (2 Replies)
Discussion started by: nixjennings
2 Replies

4. Shell Programming and Scripting

awk - replace number of string length from search and replace for a serialized array

Hello, I really would appreciate some help with a bash script for some string manipulation on an SQL dump: I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump. This is quite easy with sed: sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies

5. UNIX for Dummies Questions & Answers

Seach for part of string and replace whole word

I am trying to find words in a text with a certain ending with sed and replace them with themselves but wrapped in tabs ex.: The fish swims in the water. -> searching for -ms ending The fish <tab>swims<tab>in the water. I've been trying all sorts of commands and get either an error... (5 Replies)
Discussion started by: stinnes
5 Replies

6. Shell Programming and Scripting

How to find the count and replace the particular part of string in perl?

Hi, I am taking the current time using localtime function in perl. For example if the time is: #Using localtime $time = "12:3:10"; I have to replace the value 3 (03) i.e second position to be 03. The output should be: 12:03:10 But if the other string for example: $str:... (1 Reply)
Discussion started by: vanitham
1 Replies

7. Shell Programming and Scripting

Replace a part of the string

Hi I need to Replace a part of string in between one complete string. For e.g.. in the file the value is as: jobnm_$code_xyz_001 In script we are having a variable code=$3, where $3=ab final output should be jobnm_ab_xyz_001. But it is not working. Your help will be... (1 Reply)
Discussion started by: vee_789
1 Replies

8. Shell Programming and Scripting

SED - replace only on part of the string

Hello there, I need some help. I have a file containing this : $ cat file PARM1=(VAL11),PARM2=(VAL21,VAL22,VAL23),PARM3=(VAL31),PARM4=(VAL41,VAL42) and I need to replace all the ',' by '|' but only those which are between brackets. Output would be :... (10 Replies)
Discussion started by: Sephiburp
10 Replies

9. Shell Programming and Scripting

Deleting part of a string : string manipulation

i have something like this... echo "teCertificateId" | awk -F'Id' '{ print $1 }' | awk -F'te' '{ print $2 }' Certifica the awk should remove 'te' only if it is present at the start of the string.. anywhere else it should ignore it. expected output is Certificate (7 Replies)
Discussion started by: vivek d r
7 Replies

10. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
WebKDC::Token(3pm)					User Contributed Perl Documentation					WebKDC::Token(3pm)

NAME
WebKDC::Token - token objects for use with WebAuth SYNOPSIS
use WebKDC::Token; # includes WebKDC::{App,Id,Proxy,Request,Response,Service}Token # manually create a new token, and then encode/encrypt it my $id_token = new WebKDC::IdToken; $id_token->subject_auth('krb5'); $id_token->subject_auth_data($sad); $id_token->creation_time(time()); $id_token->expiration_time($et); my $id_token_str = bas64_encode($id_token->to_token($key)); # parse an encrypted/encoded token, given the encrypted/encoded token, # the keyring used to encrypt it, and an optional time to live. If the # TTL is not zero, the token is treated as invalid if its creation time is # more than ttl ago (this is not needed if the token had an expiration # time set when it was created). my $req_token = new WebKDC::RequestToken($req_token_str, $key, $ttl); DESCRIPTION
WebKDC::Token is the base class for all the Token objects, which are available upon using WebKDC::Token: WebKDC::AppToken WebKDC::IdToken WebKDC::ProxyToken WebKDC::RequestToken WebKDC::ErrorToken WebKDC::CredToken WebKDC::WebKDCProxyToken WebKDC::WebKDCServiceToken It contains the functions that are common across all the token objects, as well as some functions that must be overridden in the subclasses. EXPORT
None METHODS
to_token(key_or_keyring) $binary_token = $token->to_token($key_or_keyring); Takes a token object and encrypts/encodes it into a binary string. WebAuth::base64_encode should be used if the token needs to base64 encoded. to_string() $str = $token->to_string(); used mainly for debugging to get a dump of all the attributes in a token. The Token object all overloads '""', so calling this function is optional, you can just use a token object as a string to get the same result. new $token = new WebKDC::SubclassToken; $token = new WebKDC::SubclassToken($binary_token, $key_or_ring, $ttl); The new constructor for tokcns is used to create a token object. The first form is used to construct new tokens, while the second form is used to parse a binary token into a token object. Note, only subclasses of Token should be constructed using new. To parse an unknown token, use the parse class method. parse $token = WebKDC::Token::parse($binary_token, $key_or_ring, $ttl); Used to create a from a binary token when you don't know ahead of time what the resulting token type will be. The type of the returened token can be checked with token_type() or the UNIVERSAL isa method. validate_token This method should be overridden by subclasses. It is used to validate that a particular token contains the correct attributes. It gets called by the to_token method before the token is encoded, and by the constructor with args after a token has been parsed. init This method should be ovveridden by subclasses and is used to initialize a token when the constructor with no args is called. token_type([$new_value]) $token->token_type($new_value); $type = $token->token_type(); The first form is used to set the token type, the second form is used to get the token type. WebKDC::AppToken The WebKDC::AppToken object is used to represent WebAuth app-tokens. $token = new WebKDC::AppToken; $token = new WebKDC::AppToken($binary_token, $key_or_ring, $ttl); $token->app_data($name[, $new_value]) $token->creation_time([$new_value]) $token->expiration_time([$new_value]) $token->lastused_time([$lastused_time]) $token->subject([$new_value]) $token->session_key([$new_value]) $token->initial_factors([$new_value, ...]) $token->session_factors([$new_value, ...]) $token->loa([$new_value]) WebKDC::CredToken The WebKDC::CredToken object is used to represent WebAuth cred-tokens. $token = new WebKDC::CredToken; $token = new WebKDC::CredToken($binary_token, $key_or_ring, $ttl); $token->creation_time([$new_value]) $token->expiration_time([$new_value]) $token->cred_type([$new_value]) $token->cred_subject([$new_value]) $token->cred_data([$new_value]) $token->subject([$new_value]) WebKDC::IdToken The WebKDC::IdToken object is used to represent WebAuth id-tokens. $token = new WebKDC::IdToken; $token = new WebKDC::IdToken($binary_token, $key_or_ring, $ttl); $token->creation_time([$new_value]) $token->expiration_time([$new_value]) $token->subject([$new_value]) $token->subject_auth([$new_value]) $token->subject_auth_data([$new_value]) $token->initial_factors([$new_value, ...]) $token->session_factors([$new_value, ...]) $token->loa([$new_value]) WebKDC::LoginToken The WebKDC::LoginToken object is used to represent WebAuth login-tokens. $token = new WebKDC::LoginToken; $token = new WebKDC::LoginToken($binary_token, $key_or_ring, $ttl); $token->creation_time([$new_value]) $token->password([$new_value]) $token->otp([$new_value]) $token->username([$new_value]) WebKDC::ProxyToken The WebKDC::ProxyToken object is used to represent WebAuth proxy-tokens. $token = new WebKDC::ProxyToken; $token = new WebKDC::ProxyToken($binary_token, $key_or_ring, $ttl); $token->creation_time([$new_value]) $token->expiration_time([$new_value]) $token->proxy_type([$new_value]) $token->subject([$new_value]) $token->webkdc_token([$new_value]) $token->initial_factors([$new_value, ...]) $token->session_factors([$new_value, ...]) $token->loa([$new_value]) WebKDC::RequestToken The WebKDC::RequestToken object is used to represent WebAuth request-tokens. $token = new WebKDC::RequestToken; $token = new WebKDC::RequestToken($binary_token, $key_or_ring, $ttl); $token->app_state([$new_value]) $token->creation_time([$new_value]) $token->proxy_type([$new_value]) $token->request_options([$new_value]) $token->requested_token_type([$new_value]) $token->return_url([$new_value]) $token->subject_auth([$new_value]) $token->initial_factors([$new_value, ...]) $token->session_factors([$new_value, ...]) $token->loa([$new_value]) WebKDC::ErrorToken The WebKDC::ErrorToken object is used to represent WebAuth error-tokens. $token = new WebKDC::ErrorToken; $token = new WebKDC::ErrorToken($binary_token, $key_or_ring, $ttl); $token->creation_time([$new_value]) $token->error_code([$new_value]) $token->error_message([$new_value]) WebKDC::WebKDCProxyToken The WebKDC::WebKDCProxyToken object is used to represent WebAuth webkdc-proxy-tokens. $token = new WebKDC::WebKDCProxyToken; $token = new WebKDC::WebKDCProxyToken($binary_token, $key_or_ring, $ttl); $token->creation_time([$new_value]) $token->expiration_time([$new_value]) $token->proxy_data([$new_value]) $token->proxy_subject([$new_value]) $token->proxy_type([$new_value]) $token->subject([$new_value]) $token->initial_factors([$new_value, ...]) $token->loa([$new_value]) WebKDC::WebKDCServiceToken The WebKDC::WebKDCServiceToken object is used to represent WebAuth webkdc-service-tokens. $token = new WebKDC::WebKDCServiceToken; $token = new WebKDC::WebKDCServiceToken($binary_token, $key_or_ring, $ttl); $token->creation_time([$new_value]) $token->expiration_time([$new_value]) $token->subject([$new_value]) $token->session_key([$new_value]) AUTHOR
Roland Schemers (schemers@stanford.edu) SEE ALSO
WebAuth. perl v5.14.2 2012-04-25 WebKDC::Token(3pm)
All times are GMT -4. The time now is 06:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy