Sponsored Content
Top Forums Shell Programming and Scripting Need Awk command to get part of string based on delimeter Post 302449176 by kurumi on Saturday 28th of August 2010 11:36:59 PM
Old 08-29-2010
Code:
string="Input : "07:08:43 28.08.2010|SCHEDULE: Started program POSG1[(0600 08/28/10)] has completed successfully""
f="${string%%|*}"
r=${string%)\]*}
r=${r##*\[(* }
final="$f $r"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sort entire line based on part of the string

hey gurus, my-build1-abc my-build10-abc my-build2-abc my-build22-abc my-build3-abc basically i want to numerically sort the entire lines based on the build number. I dont zero pad the numbers because thats "how it is" ;-) sort -n won't work because it starts from the beginning. ... (10 Replies)
Discussion started by: gurpal2000
10 Replies

2. Shell Programming and Scripting

How to get part of string in awk from match

Hi, Im an awk noob and I am having trouble trying to get matches. Here is my script: #!/bin/gawk -f BEGIN {} $0 ~ /<a href=".*">.*<\/a>/{print} Ideally I want to be able to get the actual link and print it. In PHP you can do preg_replace and get the match you want by using \\1 where 1... (2 Replies)
Discussion started by: adsyuk
2 Replies

3. Shell Programming and Scripting

How to merge 2 files based on delimeter in perl?

Hi, I have 2 files. a.txt & b.txt # a.txt contains the following text. apple grapes # b.txt contains the following text. banana pine My question is. (1 Reply)
Discussion started by: vanitham
1 Replies

4. Web Development

split line based on delimeter SQL

I have a SQL query SELECT BLAH_ID, BLAH_CODE, DATEFORMAT(CALENDAR_DATE, 'MM-DD-YYYY') AS CALENDAR_DATE_STR, HOURS, 'N', FROM blah_tmp_tbl order by CALENDAR_DATE_STR,BLAH_ID,BLAH_CODE; OUTPUT TO 'MyExport.CSV' quote '' FORMAT ASCII; That gets me the below output; ... (2 Replies)
Discussion started by: ffdstanley
2 Replies

5. Shell Programming and Scripting

AWK Command parse a file based on string.

AWK Command parse a file based on string. I am trying to write a shell script to parse a file based on a string and move the content of the file to another file. Here is scenario. File content below Mime-Version: 1.0 Content-Type: multipart/mixed; ... (2 Replies)
Discussion started by: aakishore
2 Replies

6. 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

7. Shell Programming and Scripting

Put delimeter in data based on value

Hi Friends, I have a file as below source.txt 12345JackYKing32N 1235 JulyYoig 31N i am using cut command for cutting the fields cut -c 1-5 source.txt 12345 1235 like above i have to use each time to cut all the fieds manually. I have a file(pre.txt) which tells... (3 Replies)
Discussion started by: i150371485
3 Replies

8. Shell Programming and Scripting

Grep a part of file based on string identifiers

consider below file contents cat myOutputFIle.txt 8 CCM-HQE-ResourceHealthCheck: Resource List : No RED/UNKNOWN resource Health entries found ---------------------------------------------------------- 9 CCM-TraderLogin-Status: Number of logins: 0... (4 Replies)
Discussion started by: vivek d r
4 Replies

9. Shell Programming and Scripting

Match part of string in file2 based on column in file1

I have a file containing texts and indexes. I need the text between (and including ) INDEX and number "1" alone in line. I have managed this: awk '/INDEX/,/1$/{if (!/1$/)print}' file1.txt It works for all indexes. And then I have second file with years and indexes per year, one per line... (3 Replies)
Discussion started by: phoebus
3 Replies

10. Shell Programming and Scripting

awk - how to compare part of the string?

Need help for awk.. file will have comma separated numbers, I need check digits before 10 numbers eg ( 001)1234567890 Basically want to check country code of a mobile number. eg: abc,def,data, data,0011234567890, data,data Script should be checking country code with 001, I will pass... (10 Replies)
Discussion started by: vegasluxor
10 Replies
setenv(3C)																setenv(3C)

NAME
setenv(), unsetenv() - add, update or remove an environment variable SYNOPSIS
Parameters envname Points to a string containing the name of an environment variable to be added or altered. This should not be a NULL pointer or null string, and the string should not contain an equal character. envval Points to a string containing the value to be set for the variable envname. overwrite Indicates whether to overwrite the value of envname variable or not, if it already exists. Expected values are non-zero and zero. If the environment variable does not exist in the environment, then the value of this variable is ignored. DESCRIPTION
and functions update the environment of the calling process. If envname does not exist, the function ignores the value of overwrite and adds the variable envname to the environment with the value envval. If envname exists and overwrite is non-zero, then the variable envname is updated with the new value envval. If envname exists and overwrite is zero, then the variable is not updated, and the function is considered to have completed successfully. The function deletes the variable envname from the environment, if it exists. If the envname variable does not exist in the current envi- ronment, the environment is unchanged, and the function is considered to have completed successfully. If the application modifies environ or the pointers to which it points, the behavior of and is undefined. EXTERNAL INFLUENCES
Locale The category determines the interpretation of characters in string as single- and/or multi-byte characters. International Code Set Support Single- and multi-byte character code sets are supported. RETURN VALUE
The and functions return zero on success; otherwise they return and set to indicate the error. ERRORS
If the function fails, is set to one of the following values: Sufficient memory is not available to add a variable or its value to the environment. The envname argument is a null pointer, points to an empty string, or points to a string containing an equal character. If the function fails, is set to the following value: The envname argument is a null pointer, points to an empty string, or points to a string containing an equal character. EXAMPLES
The following code adds a new environment variable to the current environment. The following code updates the variable The following code removes the variable from the current environment. WARNINGS
The and functions manipulate the environment pointed to by environ, and can be used in conjunction with However, envp (the third argument to main) is not changed. The uses to enlarge the environment (see malloc(3C)). After the or function is called, environment variables may not be in alphabetical order. AUTHOR
and were developed by HP. SEE ALSO
exec(2), getenv(3C), malloc(3C), putenv(3C), environ(5), thread_safety(5). STANDARDS CONFORMANCE
setenv(3C)
All times are GMT -4. The time now is 08:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy