Sponsored Content
Top Forums Shell Programming and Scripting Replace dot with semicolon in PERL Post 302641579 by balajesuri on Wednesday 16th of May 2012 09:33:18 AM
Old 05-16-2012
Code:
[root@host dir]# cat input
filename| 06-Dec-11 03.04.14.000000 PM|nameisaere..rp
filename1| 06-Dec-11 05.05.14.000000 PM|erevdrname.
[root@host dir]#
[root@host dir]# perl -F"\|" -lane '$F[1]=~s/(?<=[0-9]{2})\.(?![0-9]{3,})/:/g; print join ("|", @F)' input
filename| 06-Dec-11 03:04:14.000000 PM|nameisaere..rp
filename1| 06-Dec-11 05:05:14.000000 PM|erevdrname.
[root@host dir]#

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

splitting on dot in perl

I am trying to split input that looks like ,2005-09-12 01:45:00.000000,2005-09-12 01:48:18.000000, I want to split on the dot . What I am using is ($ev_time,$rol)=split(/\./),$inputfile; This does not recognize the dot as what I want to split on. (2 Replies)
Discussion started by: reggiej
2 Replies

2. Shell Programming and Scripting

Replace path in a file with dot

Hi, I have a file with below values. /uvxapps/etl/Ascential/DataStage/DSEngine/dsenv.orig /uvxapps/etl/Ascential/DataStage/DSEngine/dsenv /uvxapps/etl/Ascential/DataStage/DSEngine/sample/.cshrc /uvxapps/etl/Ascential/DataStage/DSEngine/sample/.login... (3 Replies)
Discussion started by: njoshi
3 Replies

3. Shell Programming and Scripting

Replace blank spaces with semicolon - text file

Hi all, Been trying to find a solution to this, I'm sure its a sed 1 liner, but I don't know sed well enough to work it out... I have a text file in the following format: 431 666 1332 2665 0.24395 432 670 ... (3 Replies)
Discussion started by: mpcengineering
3 Replies

4. Shell Programming and Scripting

Replace a string after n semicolon every line

I have a file that is formatted in this way. a1;b2;c33;d4;e5;e;f;f;f;s d;ds;d;a;v;b;g;gr;r;rt;fdf s1;s2;s2;s3;s4; b1;f2;g3;h4;a3c4e;xcsd;fds; sd2;fs4;fs2;sdf3; I want to replace the value just before the 4th semicolon to empty string, regardless the value, such that it looks... (3 Replies)
Discussion started by: alienated
3 Replies

5. Shell Programming and Scripting

How to replace quote symbol(") and dot(.) with some other values!!

Hi , I have below input file 1.order number is useful. 2.vendor_id is produced. 3.the vandor name is "malawar". I want output file like 1. order number is useful. 2. vendor_id is produced. 3. the vandor name is VmalawarV. in input file line number 1.order number there is no... (4 Replies)
Discussion started by: vinothsekark
4 Replies

6. UNIX for Dummies Questions & Answers

Delete a semicolon and numbers after a semicolon

I have this: ((9:0.010,(11:0.089,13:0.004)) and I would like this: ((A9,(A11,A13)) How do I delete the semi colon and the number (i.e. 0.010) after the semi colon? Also, how can I add the letter before the number that is NOT removed? Thank you in advance! ---------- Post updated... (4 Replies)
Discussion started by: MDeBiasse
4 Replies

7. Shell Programming and Scripting

sed - search and replace whole string which contains dot

Hello. I would like to search exactly "string1.string2.string3" and replace it by "new_string1.new_string2.new_string3" And I would like to search exactly "string2.string3" and replace it by "new_string2.new_string3" And I would not found in the result : "string1.new_string2.new_string3"... (3 Replies)
Discussion started by: jcdole
3 Replies

8. Shell Programming and Scripting

Replace semicolon within double quotes in a file with semicolon delimiter

Hello Team, Could you please help me with the below question? I have a file with the following properties 1) File Delimiter is ; 2) Text columns are within double quotes 3) Numeric columns will not have double quotes 4) File has total 6 columns Please see a sample record from file ... (3 Replies)
Discussion started by: sam99
3 Replies

9. Shell Programming and Scripting

Replace null values with dot using awk

Using awk I am trying to replace all blank or null values with a . in the tad delimited input. I hope the awk is close. Thank you :). input name test sam 1 liz 2 al 1 awk awk 'BEGIN{FS=OFS="\t"}{for(i=1;++i<NF;)$i=$i?$i:"."}1'input awk 'BEGIN { FS =... (6 Replies)
Discussion started by: cmccabe
6 Replies

10. Shell Programming and Scripting

How i can add via preg replace dot after numbers ?

So lets say i have file my_birthday.402.zip ho it can became my_birthday.4.0.2.zip Thank you :) (1 Reply)
Discussion started by: ZerO13
1 Replies
selinux_raw_context_to_color(3) 			     Library Functions Manual				   selinux_raw_context_to_color(3)

NAME
selinux_raw_context_to_color - Return RGB color string for an SELinux security context SYNOPSIS
#include <selinux/selinux.h> int selinux_raw_context_to_color(security_context_t raw, char **color_str); DESCRIPTION
selinux_raw_context_to_color() returns a color_str associated to the raw context raw provided that the mcstransd(8) daemon is running, the policy is an MLS type policy (MCS or MLS) and there is a color configuration file secolor.conf(5) (see the FILES section). The color_str string is a space separated list of eight hexadecimal RGB triples, each prefixed by a hash character (#). These represent the user:role:type:range components of the foreground and background colors. An example string is shown in the EXAMPLE section. The returned color_str string must be freed with free(3). If a color has not been configured for a specific user, role, type and/or range component of context raw, then selinux_raw_context_to_color() will select the color returned in color_str in order of precedence as follows: role, type, range user, type, range user, role, range user, role, type If there are no entries in the secolor.conf(5) file for any of the components of context raw (or the file is not present), then the default string returned in color_str is: ----- user ---- ---- role ---- ---- type ---- ---- range ---- #000000 #ffffff #000000 #ffffff #000000 #ffffff #000000 #ffffff RETURN VALUE
On success, zero is returned. On failure, -1 is returned with errno set appropriately. ERRORS
ENOENT If the mcstransd(8) daemon is not running. FILES
selinux_raw_context_to_color() obtains the translated entry from the active policy secolor.conf(5) file as returned by selinux_colors_path(3). The file format is described in secolor.conf(5). NOTES
1. The primary use of selinux_raw_context_to_color() is to return a color that corresponds to a range, that can then be used to highlight information at different MLS levels. 2. The mcstransd(8) daemon process security level must dominate the raw security level passed to it by the selinux_raw_context_to_color() function. If not, the range color selected will be as defined by the order of precedence. EXAMPLE
selinux_raw_context_to_color() returns the foreground and background colors of the context string components (user:role:type:range) as RGB triples as follows: user : role : type : range fg bg : fg bg : fg bg : fg bg #000000 #ffffff #ffffff #000000 #d2b48c #ffa500 #000000 #008000 black white : white black : tan orange : black green SEE ALSO
selinux(8), selinux_colors_path(3), mcstransd(8), secolor.conf(5), selinux_raw_to_trans_context(3), selinux_trans_to_raw_context(3), free(3) SELinux API documentation 08 April 2011 selinux_raw_context_to_color(3)
All times are GMT -4. The time now is 09:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy