Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Extract a portion of string from each line in Linux Post 303017644 by RudiC on Saturday 19th of May 2018 03:43:40 PM
Old 05-19-2018
Try
Code:
awk -F"[|,]" '
NR == 1         {for (n=split (TGTSTR, T); n; n--) TGT[T[n]]
                }
                {for (i=2; i<=NF; i++) for (t in TGT) if ($i ~ t) TMP = TMP (TMP?",":"") $i
                 print $1, substr (TMP, 2)
                 TMP = ""
                }
' OFS="|" TGTSTR="destinationPath,delete" file
1|delete":true,"destinationPath":"/cd/rest/stone/data"
20|delete":true,"destinationPath":"/ab/test/rock/archive"

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to extract a portion of a string from the whole string

How to extract a portion of a string from a full string using unix. For example: Say source string is = "req92374923.log" I want only the numeric portion of the string say "92374923" how to do that in Unix. (2 Replies)
Discussion started by: ds_sastry
2 Replies

2. Shell Programming and Scripting

extract a portion of log file

hello, I want to grep the log file according to time and get the portion of log from one particular time to other. I can grep for individual lines by time but how should I print lines continuously from given start time till end till given end time. Appreciate your ideas, Thanks chandra (8 Replies)
Discussion started by: chandra004
8 Replies

3. Shell Programming and Scripting

extract date portion from file

Hi, I have a file where there is a date field (single line variable length file) how to extract just the date portion from it the position of date field may vary anywhere in the line but will always have the format mm-dd-yyyy for eg . xxxxxxxxxxxxxxx09-10-2006xxxxxxxxxxxxxxxxxxxx (5 Replies)
Discussion started by: misenkiser
5 Replies

4. Shell Programming and Scripting

how to extract a string value from the given line

Hi I have an input as follows: param1:value1|param2:value2|param3:value3|param4:value4|param5:value5 where, "|" and ":" are delimiters Now suppose, I want to extract the value corresponding to "param4", i.e. "value4" in this case. In case we use awk, I want to use the value in shell... (1 Reply)
Discussion started by: gaurav_1711
1 Replies

5. Shell Programming and Scripting

extract string portion using sed

Hi All I have 3 files as listed below and highlighted in bold the portions of the filenames I need to extract: TOS_TABIN218_20090323.200903231830 TOS_TABIN219_1_20090323.200903231830 TOS_TABIN219_2_20090323.200903231830 I tried source_tabin_name=`echo $fname | sed 's/_.*//'` but I... (6 Replies)
Discussion started by: santam
6 Replies

6. Shell Programming and Scripting

extract string portion from filename using sed

Hi All, I posted something similar before but I now have a another problem. I have filenames as below TOP_TABIN240_20090323.200903231830 TOP_TABIN235_1_20090323.200903231830 i need to extract the dates as in bold. Using bash v 3.xx Im trying to using the print sed command but... (11 Replies)
Discussion started by: santam
11 Replies

7. Shell Programming and Scripting

How to extract a text portion from a file

Can some one help me with shell script to extract a text block between two known strings. The given input file is as below: Name: abs Some tesxt.... Some tesxt.... Some tesxt.... end of text Name: xyz Some tesxt.... Some tesxt.... Some tesxt.... end of text Name: efg Some... (5 Replies)
Discussion started by: ejazs0
5 Replies

8. Shell Programming and Scripting

Extract a string from a line

Hiee all Can anyone tell me how to extract a string from a given line. STAPISDK_RELEASE_32_BL012_2011_JAN_25.1597 I want to extract BL012 from above. as 102 keeps on changing i want smthing like that it extract BL and 102 extrct by its own. Thankx guyzz (9 Replies)
Discussion started by: abhijtr
9 Replies

9. Shell Programming and Scripting

How to extract portion of a string?

Hi Gurus, Would like to seek some help on how to extract a portion of string from log's output as shown below. Sample of raw data: piece handle=/test123/disk_dump/test123/df0_cntrl_PCPFCI20120404_68498 tag=TAG20120404T180035 comment=NONE piece... (13 Replies)
Discussion started by: superHonda123
13 Replies

10. Shell Programming and Scripting

Extract portion of data

Hi Gurus, I need some help in extracting some of these information and massage it into the desired output as shown below. I need to extract the last row with the header in below sample which is usually the most recent date, for example: 2012-06-01 142356 mb 519 -219406 mb 1 ... (9 Replies)
Discussion started by: superHonda123
9 Replies
warn.conf(4)							   File Formats 						      warn.conf(4)

NAME
warn.conf - Kerberos warning configuration file SYNOPSIS
/etc/krb5/warn.conf DESCRIPTION
The warn.conf file contains configuration information specifying how users will be warned by the ktkt_warnd daemon about ticket expiration. In addition, this file can be used to auto-renew the user's Ticket-Granting Ticket (TGT) instead of warning the user. Credential expiration warnings and auto-renew results are sent, by means of syslog, to auth.notice. Each Kerberos client host must have a warn.conf file in order for users on that host to get Kerberos warnings from the client. Entries in the warn.conf file must have the following format: principal [renew[:opt1,...optN]] syslog|terminal time or: principal [renew[:opt1,...optN]] mail time [email address] principal Specifies the principal name to be warned. The asterisk (*) wildcard can be used to specify groups of principals. renew Automatically renew the credentials (TGT) until renewable lifetime expires. This is equivalent to the user running kinit -R. The renew options include: log-success Log the result of the renew attempt on success using the specified method (syslog|terminal|mail). log-failure Log the result of the renew attempt on failure using the specified method (syslog|terminal|mail). Some renew failure conditions are: TGT renewable lifetime has expired, the KDCs are unavailable, or the cred cache file has been removed. log Same as specifing both log-success and log-failure. Note - If no log options are given, no logging is done. syslog Sends the warnings to the system's syslog. Depending on the /etc/syslog.conf file, syslog entries are written to the /var/adm/messages file and/or displayed on the terminal. terminal Sends the warnings to display on the terminal. mail Sends the warnings as email to the address specified by email_address. time Specifies how much time before the TGT expires when a warning should be sent. The default time value is seconds, but you can specify h (hours) and m (minutes) after the number to specify other time values. email_address Specifies the email address at which to send the warnings. This field must be specified only with the mail field. EXAMPLES
Example 1 Specifying Warnings The following warn.conf entry * syslog 5m specifies that warnings will be sent to the syslog five minutes before the expiration of the TGT for all principals. The form of the mes- sage is: jdb@ACME.COM: your kerberos credentials expire in 5 minutes Example 2 Specifying Renewal The following warn.conf entry: * renew:log terminal 30m ...specifies that renew results will be sent to the user's terminal 30 minutes before the expiration of the TGT for all principals. The form of the message (on renew success) is: myname@ACME.COM: your kerberos credentials have been renewed FILES
/usr/lib/krb5/ktkt_warnd Kerberos warning daemon ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
kinit(1), kdestroy(1), ktkt_warnd(1M), syslog.conf(4), utmpx(4), attributes(5), kerberos(5), pam_krb5(5) NOTES
The auto-renew of the TGT is attempted only if the user is logged-in, as determined by examining utmpx(4). SunOS 5.11 30 Mar 2005 warn.conf(4)
All times are GMT -4. The time now is 02:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy