Sponsored Content
Top Forums Shell Programming and Scripting perl get partial string of a string Post 302347148 by pludi on Tuesday 25th of August 2009 02:57:13 AM
Old 08-25-2009
Regex can do a lot, but not that (and never were intended to [unless someone wants to prove me wrong])
Code:
perl -e '$val=14480; $hms=sprintf("%02d%02d%02d",int($val/3600),int($val%3600/60),int($val%60)); print $hms,"\n";'
040120

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Better way to match string within a string

Hi, I'm trying to get one field out of many as follows: A string of multiple fields separated with "/" characters: "/ab=12/cd=34/12=ab/34=cd/ef=pick-this.one/gh=blah/ij=something/" I want to pick up the field "ef=pick-this.one" which has no regular pattern except it starts with "ef=xxxx"... (3 Replies)
Discussion started by: Juha
3 Replies

2. UNIX for Advanced & Expert Users

delete line from file if successful partial string found

Id like to delete a line from a file using (preferably a single line unix command) if it contains a certain string pattern. If line contains "abcdef" then delete that line. Help greatly appreciated. (7 Replies)
Discussion started by: cronjob78
7 Replies

3. Shell Programming and Scripting

[Perl] Find one string, change another string.

Hi, In principle I am searching for a Perl equivalent for this sed command: sed "/TIM_AM_ARGS=/ s/60/1440/" $EDIT_FILE > $TEMP_FILE cp $TEMP_FILE $EDIT_FILE I was wondering if it needs to be like this, or that there other, shorter, alternatives: open (TIMENVFILE, "<$timenvfile") or die... (5 Replies)
Discussion started by: ejdv
5 Replies

4. Shell Programming and Scripting

get partial numbers from a string

Hi Everyone, I have: $val="QQ3_1899_CD4". The output will be: 1899. I did $val =~ /(\d+)/g; the output is 318994, then i use substr to get those 1899. This is not efficient. Is any simple way, like just one line can do? Thanks (1 Reply)
Discussion started by: jimmy_y
1 Replies

5. Shell Programming and Scripting

Extract partial string from path.

Hi all, i've a string $DIR=/u/user/NDE/TEST_LOGS/20110622_000005_TEST_11_HD_120/HD/TEST_11_HD_120/hd-12 i need to extract string from 2011.... i.e i need it as 20110622_000005_TEST_11_HD_120 as matched string, and in turn i need to split values 20110622_000005_TEST_11_HD_120 into two.... (6 Replies)
Discussion started by: asak
6 Replies

6. Shell Programming and Scripting

How to replace partial string

I have a list of strings in file: 10 10 AAA 120 13 BBBBB 23 11 CCCCC 11 32 DDDDDD I want to replace first column of the text such as: 10, 129, 23, 11 with 11, 22, 33, 44. I can do line by line, but just not sure how to replace partial string without... (1 Reply)
Discussion started by: ford99
1 Replies

7. Shell Programming and Scripting

How to replace partial of string in file?

Hi Guys, I need replace part of string in a file. for example: ABC=123 CDE=122 DEF=456 ABC=123 DED=333 ABC=123 I need replace the value after ABC=, highlighted in red. I want to get following result; ABC=456 CDE=122 DEF=456 ABC=456 DED=333 ABC=456 Anybody can help me this. ... (8 Replies)
Discussion started by: ken6503
8 Replies

8. Shell Programming and Scripting

Remove not only the duplicate string but also the keyword of the string in Perl

Hi Perl users, I have another problem with text processing in Perl. I have a file below: Linux Unix Linux Windows SUN MACOS SUN SUN HP-AUX I want the result below: Unix Windows SUN MACOS HP-AUX so the duplicate string will be removed and also the keyword of the string on... (2 Replies)
Discussion started by: askari
2 Replies

9. Shell Programming and Scripting

awk partial string match and add specific fields

Trying to combine strings that are a partial match to another in $1 (usually below it). If a match is found than the $2 value is added to the $2 value of the match and the $3 value is added to the $3 value of the match. I am not sure how to do this and need some expert help. Thank you :). file ... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
DWARF_GET_AT_NAME(3)					   BSD Library Functions Manual 				      DWARF_GET_AT_NAME(3)

NAME
dwarf_get_ACCESS_name, dwarf_get_AT_name, dwarf_get_ATE_name, dwarf_get_CC_name, dwarf_get_CFA_name, dwarf_get_CHILDREN_name, dwarf_get_DS_name, dwarf_get_DSC_name, dwarf_get_EH_name, dwarf_get_END_name, dwarf_get_FORM_name, dwarf_get_ID_name, dwarf_get_INL_name, dwarf_get_LANG_name, dwarf_get_LNE_name, dwarf_get_LNS_name, dwarf_get_MACINFO_name, dwarf_get_OP_name, dwarf_get_ORD_name, dwarf_get_TAG_name, dwarf_get_VIRTUALITY_name, dwarf_get_VIS_name -- retrieve the symbolic names of DWARF constants LIBRARY
DWARF Access Library (libdwarf, -ldwarf) SYNOPSIS
#include <libdwarf.h> int dwarf_get_ACCESS_name(unsigned val, char **str); int dwarf_get_AT_name(unsigned val, char **str); int dwarf_get_ATE_name(unsigned val, char **str); int dwarf_get_CC_name(unsigned val, char **str); int dwarf_get_CFA_name(unsigned val, char **str); int dwarf_get_CHILDREN_name(unsigned val, char **str); int dwarf_get_DS_name(unsigned val, char **str); int dwarf_get_DSC_name(unsigned val, char **str); int dwarf_get_EH_name(unsigned val, char **str); int dwarf_get_END_name(unsigned val, char **str); int dwarf_get_FORM_name(unsigned val, char **str); int dwarf_get_ID_name(unsigned val, char **str); int dwarf_get_INL_name(unsigned val, char **str); int dwarf_get_LANG_name(unsigned val, char **str); int dwarf_get_LNE_name(unsigned val, char **str); int dwarf_get_LNS_name(unsigned val, char **str); int dwarf_get_MACINFO_name(unsigned val, char **str); int dwarf_get_OP_name(unsigned val, char **str); int dwarf_get_ORD_name(unsigned val, char **str); int dwarf_get_TAG_name(unsigned val, char **str); int dwarf_get_VIRTUALITY_name(unsigned val, char **str); int dwarf_get_VIS_name(unsigned val, char **str); DESCRIPTION
These functions return the symbolic name of a numeric DWARF constant. Argument val specifies the numeric value whose symbolic name is desired. Argument str should point to a location which will hold the returned NUL-terminated string containing the symbolic name of the specified value. The list of functions and the DWARF constants that they accept are: dwarf_get_ACCESS_name() DW_ACCESS_* constants. dwarf_get_AT_name() DW_AT_* constants. dwarf_get_ATE_name() DW_ATE_* constants. dwarf_get_CC_name() DW_CC_* constants. dwarf_get_CFA_name() DW_CFA_* constants. dwarf_get_CHILDREN_name() DW_CHILDREN_* constants. dwarf_get_DS_name() DW_DS_* constants. dwarf_get_DSC_name() DW_DSC_* constants. dwarf_get_EH_name() DW_EH_PE_* constants. dwarf_get_END_name() DW_END_* constants. dwarf_get_FORM_name() DW_FORM_* constants. dwarf_get_ID_name() DW_ID_* constants. dwarf_get_INL_name() DW_INL_* constants. dwarf_get_LANG_name() DW_LANG_* constants. dwarf_get_LNE_name() DW_LNE_* constants. dwarf_get_LNS_name() DW_LNS_* constants. dwarf_get_MACINFO_name() DW_MACINFO_* constants. dwarf_get_OP_name() DW_OP_* constants. dwarf_get_ORD_name() DW_ORD_* constants. dwarf_get_TAG_name() DW_TAG_* constants. dwarf_get_VIRTUALITY_name() DW_VIRTUALITY_* constants. dwarf_get_VIS_name() DW_VIS_* constants. RETURN VALUES
These functions return DW_DLV_OK on success. If the DWARF constant denoted by argument val is not recognized, these function return DW_DLV_NO_ENTRY. SEE ALSO
dwarf(3) BSD
April 22, 2011 BSD
All times are GMT -4. The time now is 02:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy