Sponsored Content
Top Forums Shell Programming and Scripting Read the apecific data from one file and write into another file Post 302439241 by bha148 on Thursday 22nd of July 2010 06:37:55 AM
Old 07-22-2010
Bug Read the apecific data from one file and write into another file

Hi, I would like to read the specific data from file and write the data in the new file.

My data input is something like this..

Code:
<EXROP:R=TJ0311T;
ROUTE DATA
R        ROUTE PARAMETERS
TJ0311T  DETY=UPDR     TTRANS=1   FNC=3      
         MA=628160955000      
         R=TJ0311D
         ST=7       SI=ISUP4    SP=2-1021   

         GENERIC PARAMETERS IN ROUTE OWNER
         MGG=ISUP51

END


R        ROUTE PARAMETERS
TJ0312T  DETY=UPDR     TTRANS=1   FNC=3      
         MA=628160955000      
         R=TJ0311D
         ST=7       SI=ISUP4    SP=2-1022   

         GENERIC PARAMETERS IN ROUTE OWNER
         MGG=ISUP52

END

Expected output should be....

Code:
TJ0311T  DETY=UPDR  SP=2-1021  MGG=ISUP51
TJ0312T  DETY=UPDR  SP=2-1022  MGG=ISUP52


Kindly help to write a script..
Thanks in advance.

Moderator's Comments:
Mod Comment Use code tags please, ty.

Last edited by bha148; 07-22-2010 at 07:44 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read and write from a file

I have tried to show the file name whose size is greater than 200 byte in current directory. Please help me. ls -l | tr -s " " " " | cut -f 5,9 -d " " >out.txt #set -a x `cat out.txt` i=0 `cat out.txt` | while do read x echo $x #re=200 j=0 if }" < "200" ] then echo $j j=`expr $j... (2 Replies)
Discussion started by: rinku
2 Replies

2. Programming

Read/Write a fairly large amount of data to a file as fast as possible

Hi, I'm trying to figure out the best solution to the following problem, and I'm not yet that much experienced like you. :-) Basically I have to read a fairly large file, composed of "messages" , in order to display all of them through an user interface (made with QT). The messages that... (3 Replies)
Discussion started by: emitrax
3 Replies

3. Shell Programming and Scripting

Read Write byte range/chunk of data from specific location in file

I am new to Unix so will really appreciate if someone can guide me on this. What I want to do is: Step1: Read binary file - pick first 2 bytes, convert from hex to decimal. Read the next 3 bytes as well. 2 bytes will specify the number of bytes 'n' that I want to read and write... (1 Reply)
Discussion started by: Kbenipel
1 Replies

4. Shell Programming and Scripting

Extract data from an XML file & write into a CSV file

Hi All, I am having an XML tag like: <detail sim_ser_no_1="898407109001000090" imsi_1="452070001000090"> <security>ADM1=????</security> <security>PIN1=????</security> <security>PIN2=????</security> ... (2 Replies)
Discussion started by: ss_ss
2 Replies

5. Shell Programming and Scripting

Unfold the data from a input file and write to a file

I am working on a script to unfold data for each column from a specific line of data and write output in a single line. Input data looks like this. 2011-09-26 INF UM_10 UserMana Starting synchronization for security domain 14:37:31 080 gementSe . rvice I... (2 Replies)
Discussion started by: svajhala
2 Replies

6. Shell Programming and Scripting

how read specific line in a file and write it in a new text file?

I have list of files in a directory 'dir'. Each file is of type HTML. I need to read each file and get the string which starts with 'http' and write them in a new text file. How can i do this shell scripting? file1.html <head> <url>http://www.google.com</url> </head> file2.html <head>... (6 Replies)
Discussion started by: vel4ever
6 Replies

7. Shell Programming and Scripting

Read user input, Encrypt the data and write to file

Hi, can some one help me how to encrypt and decrypt a file. AIM: reade user input, encrypt it and save it to file. while decryption read the encrypted file decrypt it and save the output in some variable. Example: consider we have Credentials.txt file with content username: password... (5 Replies)
Discussion started by: saichand1985
5 Replies

8. Shell Programming and Scripting

Read a file and write to new file with some condition

Hi.... I have a data file, which I want to split and write to new file...it looks like this... Column1 column2 Column 3 1 28.25 36.42 -----Read 5 28.26 36.42 10 28.23 36.43 15 28.22 36.43... (1 Reply)
Discussion started by: nex_asp
1 Replies

9. Shell Programming and Scripting

Extract data from XML file and write in CSV file

Hi friend i have input as following XML file <?xml version="1.0"?> <Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02"> <BkToCstmrDbtCdtNtfctn> <GrpHdr><MsgId>LBP-RDJ-TE000000-130042430010001001</MsgId><CreDtTm>2013-01-04T03:21:30</CreDtTm></GrpHdr>... (3 Replies)
Discussion started by: mohan sharma
3 Replies

10. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies
pthread_rwlock_init(3)					     Library Functions Manual					    pthread_rwlock_init(3)

NAME
pthread_rwlock_init - Initializes a read-write lock object. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread.h> int pthread_rwlock_init( pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr); PARAMETERS
Read-write lock object to be initialized. Read-write lock attributes object that defines the characteristics of the read-write lock to be initialized. DESCRIPTION
This routine initializes a read-write lock object with the attributes specified by the read-write lock attributes object specified in attr. A read-write lock is a synchronization object that serializes access to shared information that needs to be read frequently and written only occasionally. A thread can acquire a read-write lock for shared read access or for exclusive write access. Upon successful completion of this routine, the read-write lock is initialized and set to the unlocked state. If attr is set to NULL, the default read-write lock attributes are used; the effect is the same as passing the address of a default read-write lock attributes object. Once initialized, the lock can be used any number of times without being reinitialized. Results of calling this routine are undefined if attr specifies an already initialized read-write lock or if rwlock is used without first being initialized. If this routine returns unsuccessfully, rwlock is not initialized and the contents of rwlock are undefined. A read-write lock is a resource of the process, not part of any particular thread. A read-write lock is neither destroyed not unlocked automatically when any thread exits. Because read-write locks are shared, they may be allocated in heap or static memory, but not on a stack. In cases where default read-write lock attributes are appropriate, you may use the PTHREAD_RWLOCK_INITIALIZER macro to statically initial- ize the lock object without calling this routine. The effect is equivalent to dynamic initialization by a call to pthread_rwlock_init with attr specified as NULL, except that no error checks are performed. Statically initialized read-write locks need not be destroyed using pthread_rwlock_destroy. Use the PTHREAD_RWLOCK_INITIALIZER macro as follows: pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows: Successful completion. The system lacks the necessary resources to initialize the read-write lock. The implementation has detected an attempt to reinitialize the read-write lock (a previously initialized, but not yet destroyed read-write lock object). The value specified by attr is not a valid attributes block. Insufficient memory exists to initialize the read-write lock. The caller does not have privi- leges to perform this operation. ERRORS
None RELATED INFORMATION
Functions: pthread_rwlock_destroy(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_rwlock_init(3)
All times are GMT -4. The time now is 02:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy