How to strip some characters before putting in array?
Hi Gurus,
my current code like below:
I have file like below. (this is autosys job dependencies)
the job with s() is dependencies, the job without s() is job need to be run. my task is to find all dependency jobs which not in the box. some of the above code I got from the folks in this fourm.
I am wondering if it is possible to remove
and in second awk, I can strip s() and put only job name in the array.
thanks for your reply,
the code works. there is a little thing
replace all "s" in the file. example:
become
is there any way I can replace "s(" as whole?
thanks in advance.
---------- Post updated at 09:58 PM ---------- Previous update was at 09:09 PM ----------
Quote:
Originally Posted by ken6503
Hi disedorgue,
thanks for your reply,
the code works. there is a little thing
replace all "s" in the file. example:
become
is there any way I can replace "s(" as whole?
would you please give me brief explanation about
thanks again.
---------- Post updated at 11:10 AM ---------- Previous update was at 10:32 AM ----------
Quote:
Originally Posted by RavinderSingh13
Hello ken6503,
Could you please try following, it may help you.
Output will be as follows. EDIT: Adding a non one liner form for same.
Thanks,
R. Singh
Thanks R.Singh.
the code works.
I have some questions about this code.
1. what is the difference between "gsub(/s\(/,X,$NF)" and "gsub(/s\(/,"",$NF)"
2. Is it necessary to read the file twice? in the code, think it only execute NR==FNR.
I tried below code, the results are same
i need to add 2 string variables into a positioning array , repeatedly - in loop.
First string in $2, second to $3 then up to the desired count incrementing the "position".
Using set -- alone does not increment the count so I end up with 2 variables in the array.
How do I increment the... (7 Replies)
Hi All,
I currently have flat file with 32 columns. The field delimiter is cntl-A ( \x01). The file has been extracted from an oracle table using a datastage job. However, in the 6th field, the data contains additional control -A characters which came as a part of the table data.
I need... (12 Replies)
I have a postgres sql statement that is the following:
select age from students;
which gives me the entries:
Age
---
10
15
13
12
9
14
10
which is about 7 rows of data.
Now what I would like to do with this is use a shell script to create an array age. As a results... (3 Replies)
Hi Experts,
How to sepearate the list digit with letters : with a space from where the letters begins, or other words from where the digits ended.
file
52087mo(enbatl)
52049mo(enbatl)
52085mo(enbatl)
25051mo(enbatl)
The output should be looks like:
52087 mo(enbatl)
52049... (10 Replies)
I want to strip first few characters from each record until a proper datesamp is found.
Request for getNextPage.................06/29/12 07:49:30 VVUKOVIC@67.208.166.131{7A805FEF76A62FCBB23EA78B5380EF95.tomcat1}TP-Processor14 LogExchUsage: ERROR:: isprof=false : exch=NSDQ
output should be... (2 Replies)
I need to separate Pascal style identifiers (TheyLookLikeThis) into words separated by an underscore (_).
I've tried sed 's//&_&/' but this won't work (obviously). I'd love some help. (4 Replies)
Hi,
I would write a shell script to execute a series of command. However, if the cmd contains "-" in the array. It fails to do so.
I'd tried use ', " or \ but get the same result.
Output: (1 Reply)
Hi,
I wish to store $string1 in $string1array a character in each array element.
Then i wish to echo the entire array to the screen so that it reads as the normal string again.
I have been trying with the code below but does not work. Please help...
To put string into array:
... (5 Replies)
Hi,
Could anybody please guide how to strip all charaters after the last '/' from a string in a shell script.
I have got few strings like
"/tmp/oracle/oradata1/abc" or "/var/log/backup/bdfd" and I want to strip anything after the last "/" i.e "abc" and "bdfd" in my case.
Thanks,
Jamal (3 Replies)