Sponsored Content
Top Forums Shell Programming and Scripting Help in extracting fields from a file Post 302575585 by Rajesh Putnala on Tuesday 22nd of November 2011 06:07:05 AM
Old 11-22-2011
Quote:
Originally Posted by smilesavvy
Hi Rajesh,
1.Please try to give one filename instead of ./$1.txt
2.Please find out how long the query execution process takes time so that we need to set the Sleep time command.
3.Suspend the script using sleep for a while then execute the nawk or awk.
Hi,
I have tried the way you have suggested,
No change in situation.still not working.
The query is taking less than 5s in sql.
I have used sleep 10 in the code.
But it didnt worked with the changes.Smilie
Code:
while read var_ack_party_name
do
print -p "set pagesize 0 feedback off verify off heading off echo off linesize 100 \n"
print -p "select *  from bus_event where ack_party_name like 'MOVE_USAGE_DAEMON%' and event_data_text like '%"$var_ack_party_name"%';"
done <./20111011.71BC.LOG.txt
sleep 10
nawk '{if($2 ~ "^[a-zA-Z]"){print $1,substr($3,length($3),1)}}'  ./output.txt | while read a b
do
echo $a
echo $b 
MoveUsageDaemon -r $b -i $b -e $a -p 1
done

---------- Post updated at 06:07 AM ---------- Previous update was at 05:45 AM ----------

Quote:
Originally Posted by smilesavvy
Hi Rajesh,
1.Please try to give one filename instead of ./$1.txt
2.Please find out how long the query execution process takes time so that we need to set the Sleep time command.
3.Suspend the script using sleep for a while then execute the nawk or awk.
can we use wait here?is there any way to find the pid of the process which is executing the query?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting fields from an output 8-)

I am getting a variable as x=2006/01/18 now I have to extract each field from it. Like x1=2006, x2=01 and x3=18. Any idea how? Thanks a lot for help. Thanks CSaha (6 Replies)
Discussion started by: csaha
6 Replies

2. UNIX for Dummies Questions & Answers

Extracting information from text fields.

Dear friends, I'm a novice Unix user and I'm trying to learn the ropes. I have a big task I have to accomplish and I'm convinced Unix can get the job done, I just haven't figured out how. I recently posted on the topic of cutting text between unique text patterns and somebody helped me a great... (24 Replies)
Discussion started by: spindoctor
24 Replies

3. Shell Programming and Scripting

extracting fields

Hi, i have a line with several fields (indefinite number of - count varies) separated by colon. Now, i need to pick each field (except the first one) and have it assigned to variable within a loop. In other words, in the first iteration of the loop, the variable must be assigned with 2nd... (2 Replies)
Discussion started by: prvnrk
2 Replies

4. Shell Programming and Scripting

Extracting records with unique fields from a fixed width txt file

Greetings, I would like to extract records from a fixed width text file that have unique field elements. Data is structured like this: John A Smith NY Mary C Jones WA Adam J Clark PA Mary Jones WA Fieldname / start-end position Firstname 1-10... (8 Replies)
Discussion started by: sitney
8 Replies

5. Shell Programming and Scripting

Removing LF and extracting two fields

I need some assistance, I am writing a script in bash. I want to do two things: 1/. I want to replace the LF at the end of the RFH  Ø  ¸MQSTR ¸ so I can process the file record by record using a while loop. 2/. I want to extract two fields from each record, they are identified with... (1 Reply)
Discussion started by: gugs
1 Replies

6. Shell Programming and Scripting

Extracting fields from file

I am need to extract a number of values from a file, put have now clue how to do this. The file looks like this: # My file Dest=87;CompatibleSystemSoftwareVersion=2.5300-; Dest=87;ImageVersion=000061f3;SystemSoftwareVersion=2.5300;CDN=http://my.backup.com/download.txt;CDN_Timeout=30; I... (3 Replies)
Discussion started by: MagicDude4Eva
3 Replies

7. Shell Programming and Scripting

Extracting Some fields from current file to another file

Hi, I have multiple files in a directory all I am trying to do is to read the files in the directory and extract data from 2nd field till 10th field and put it in a new files. The files are pipe delimited. The new file will have the same name as the old file but the prefix of PRE_oldfilename. ... (1 Reply)
Discussion started by: simi28
1 Replies

8. Shell Programming and Scripting

need help in writing a script for extracting fields

Hi, I need to extract last character of the field retrieved from the database using select command. eg: select event,text from event_data; o/p: Event1,text1 But I need to extract only '1' from the fields...similarly '2' from Event2,text2 and '3' from Event3,text3 etc., and need to pass... (6 Replies)
Discussion started by: Rajesh Putnala
6 Replies

9. Shell Programming and Scripting

UNIX extracting fields

I have one file A.txt which is comma separated and I want to extract first 4 field's in a file and also I want to add one more column in output A.txt in output for all records. A.txt should not be hard coded since I do not filename it may be any file. (1 Reply)
Discussion started by: vamsi.valiveti
1 Replies

10. UNIX for Beginners Questions & Answers

Extracting specific fields from an XML file

Hello All, I have a requirement to split the input.xml file different files and i have tried using earlier examples(where i have posted in the forum), but still no luck Here is my input.xml <jms-system-resource> <name>UMSJMSSystemResource</name> ... (4 Replies)
Discussion started by: Siv51427882
4 Replies
PAPI_remove_events(3)						       PAPI						     PAPI_remove_events(3)

NAME
PAPI_remove_events - Remove an array of hardware event codes from a PAPI event set. SYNOPSIS
Detailed Description A hardware event can be either a PAPI Preset or a native hardware event code. For a list of PAPI preset events, see PAPI_presets or run the papi_avail utility in the PAPI distribution. PAPI Presets can be passed to PAPI_query_event to see if they exist on the underlying architecture. For a list of native events available on current platform, run papi_native_avail in the PAPI distribution. It should be noted that PAPI_remove_events can partially succeed, exactly like PAPI_add_events. C Prototype: #include <papi.h> int PAPI_remove_events( int EventSet, int * EventCode, int number ); Parameters: EventSet an integer handle for a PAPI event set as created by PAPI_create_eventset *Events an array of defined events number an integer indicating the number of events in the array *EventCode Return values: Positive integer The number of consecutive elements that succeeded before the error. PAPI_EINVAL One or more of the arguments is invalid. PAPI_ENOEVST The EventSet specified does not exist. PAPI_EISRUN The EventSet is currently counting events. PAPI_ECNFLCT The underlying counter hardware can not count this event and other events in the EventSet simultaneously. PAPI_ENOEVNT The PAPI preset is not available on the underlying hardware. Example: int EventSet = PAPI_NULL; int Events[] = {PAPI_TOT_INS, PAPI_FP_OPS}; int ret; // Create an empty EventSet ret = PAPI_create_eventset(&EventSet); if (ret != PAPI_OK) handle_error(ret); // Add two events to our EventSet ret = PAPI_add_events(EventSet, Events, 2); if (ret != PAPI_OK) handle_error(ret); // Start counting ret = PAPI_start(EventSet); if (ret != PAPI_OK) handle_error(ret); // Stop counting, ignore values ret = PAPI_stop(EventSet, NULL); if (ret != PAPI_OK) handle_error(ret); // Remove event ret = PAPI_remove_events(EventSet, Events, 2); if (ret != PAPI_OK) handle_error(ret); * @see PAPI_cleanup_eventset PAPI_destroy_eventset PAPI_event_name_to_code PAPI_presets PAPI_add_event PAPI_add_events.fi Author Generated automatically by Doxygen for PAPI from the source code. Version 5.2.0.0 Tue Jun 17 2014 PAPI_remove_events(3)
All times are GMT -4. The time now is 10:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy