Sponsored Content
Top Forums Shell Programming and Scripting Extract header data from one file and combine it with data from another file Post 302738861 by nex_asp on Monday 3rd of December 2012 03:28:21 AM
Old 12-03-2012
Its not easy it seems..

from 2nd post,

see https://www.unix.com/members/31298.html

file base of asc and hdr must match then only it should add latitude, longitude, etc...to main file, solution given by pamu is working fine, but to process number of files I have to include for loop, so I had asked...if anybody knows any good book or link to learn shell scripting please put link, I am very poor, in shell scripting..I know only C...

---------- Post updated at 03:28 AM ---------- Previous update was at 03:07 AM ----------

actually header file is having more information when I tried with another file I got wrong result....

Pamu's script reads, full header file, it should not read actually it has to filter out only particular information only...

they are ship,cruise,station, lat,long,DEPTH(SONIC),DEPTH(CAST),sst, and cast

Code:
* Sea-Bird SBE19plus Data File: 
* FileName = D:\SK-296_CTD_portable\Hex_data\n12a001001.hex 
* Software Version 1.59 
* Temperature SN =  6336 
* Conductivity SN =  6336 
* System UpLoad Time = Jul 14 2012 18:12:59 
** SHIP : India-ship 
** CRUISE : 500
** STATION : n12a001 
** LAT : 21 12.1985 N 
** LONG : 89 27.016 E 
** DEPTH(SONIC) : 93 m 
** DEPTH(CAST) : 77.7 m 
** SST : 29 degC 
* ds 
* SBE 19plus V 2.3  SERIAL NO. 6336    14 Jul 2012 17:58:03 
* vbatt = 12.2, vlith =  8.6, ioper =  61.8 ma, ipump =  39.9 ma, 
* iext01 =   4.6 ma, iext2345 =  27.1 ma 
* status = not logging 
* number of scans to average = 1 
* samples = 103375, free = 3767104, casts = 11 
* mode = profile, minimum cond freq = 2700, pump delay = 60 sec 
* autorun = no, ignore magnetic switch = no 
* battery type = alkaline, battery cutoff =  7.5 volts 
* pressure sensor = strain gauge, range = 5076.0 
* SBE 38 = no, WETLABS = no, OPTODE = no, Gas Tension Device = no 
* Ext Volt 0 = yes, Ext Volt 1 = no 
* Ext Volt 2 = yes, Ext Volt 3 = no 
* Ext Volt 4 = yes, Ext Volt 5 = no 
* echo characters = yes 
* output format = raw HEX 
 
* S> 
* 19plus 
* dh 
* cast   1 13 Jul 2012 07:31:59 samples 1 to 8619, avg = 1, stop = mag switch

-----
still some texts are there...not including...

Pls help....

Last edited by Scott; 12-03-2012 at 03:15 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Programming

to find header in Mp3 file and retrieve data

hi all, In an mp3 file , data is arranged in sequence of header and data ,how to retrieve data between two headers. Is the data between two headers fixed? because as per theory it says 1152 samples will be there , but dont knw how many bits one sample correspond to? it would help if any c... (2 Replies)
Discussion started by: shashi
2 Replies

2. Shell Programming and Scripting

insert a header in a huge data file without using an intermediate file

I have a file with data extracted, and need to insert a header with a constant string, say: H|PayerDataExtract if i use sed, i have to redirect the output to a seperate file like sed ' sed commands' ExtractDataFile.dat > ExtractDataFileWithHeader.dat the same is true for awk and... (10 Replies)
Discussion started by: deepaktanna
10 Replies

3. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

4. Shell Programming and Scripting

Extract specific content from data and rename its header problem asking

Input file 1: >pattern_5 GAATTCGTTCATGTAGGTTGASDASFGDSGRTYRYGHDGSDFGSDGGDSGSDGSDFGSDF ATTTAATTATGATTCATACGTCATATGTTATTATTCAATCGTATAAAATTATGTGACCTT SDFSDGSDFKSDAFLKJASLFJASKLFSJAKJFHASJKFHASJKFHASJKFHSJAKFHAW >pattern_1 AAGTCTTAAGATATCACCGTCGATTAGGTTTATACAGCTTTTGTGTTATTTAAATTTGAC... (10 Replies)
Discussion started by: patrick87
10 Replies

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

6. Shell Programming and Scripting

get data from files combine them to a file

hi people; this is my file1.txt:192.168.1.1 192.168.1.2 192.168.1.3 192.168.1.4 ... this is my file2.txt:portnames usernames maxusercap ... i want to write to file3.txt:l ./getports 192.168.1.1 'get all;l+;get . portnames;l-' l ./getports 192.168.1.1 'get all;l+;get . usernames;l-'... (4 Replies)
Discussion started by: gc_sw
4 Replies

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

8. Shell Programming and Scripting

How to combine data from 2 file ? How to print ?

Dear friends, I am just trying to print data from 2 file,namely file_1.txt and file_1.dat (specific column of ROW 1) file_1.txt 12 13 14 15 99 AMC 69 36 89 12 13 14 15 99 AMC 69 84 -12 12 13 14 ... (6 Replies)
Discussion started by: nex_asp
6 Replies

9. Shell Programming and Scripting

Combine data out of 3 files into one new file

Hi, How can I combine the data of of three files into one new file? I try to give as much informations as possible. The three existing files are called file1 file2 and file3 the new file should named output_combined. The size of the files will be around 900 words/lines each .. but always... (5 Replies)
Discussion started by: MyMemberName
5 Replies

10. Shell Programming and Scripting

Bash to verify and validate file header and data type

The below bash is a file validation check executed that will verify the correct header count of 10 and the correct data type in each field of the tab-delimited file. The key has the data type of each field in it. My real data has 58 headers in it but only the header and next row need to be... (6 Replies)
Discussion started by: cmccabe
6 Replies
AnyEvent::XMPP::Ext::MUC(3pm)				User Contributed Perl Documentation			     AnyEvent::XMPP::Ext::MUC(3pm)

NAME
AnyEvent::XMPP::Ext::MUC - Implements XEP-0045: Multi-User Chat SYNOPSIS
my $con = AnyEvent::XMPP::Connection->new (...); $con->add_extension (my $disco = AnyEvent::XMPP::Ext::Disco->new); $con->add_extension (my $muc = AnyEvent::XMPP::Ext::MUC->new (disco => $disco)); ... DESCRIPTION
This module handles multi user chats and provides new events to catch multi user chat messages. It intercepts messages from the connection so they don't interfere with your other callbacks on the connection. This extension requires the AnyEvent::XMPP::Ext::Disco extension for service discovery. METHODS
new This is the constructor for a MUC extension object. It takes no further arguments. is_conference ($con, $jid, $cb) TODO is_room ($con, $jid, $cb) This method sends a information discovery to the $jid, via the connection $con. $cb is called when the information arrives or with an error after the usual IQ timeout. When the $jid was a room $cb is called with the first argument being a AnyEvent::XMPP::Ext::MUC::RoomInfo object. If the destination wasn't reachable, the room doesn't exist or some other error happened the first argument will be undefined and the second a AnyEvent::XMPP::Error::IQ object. join_room ($con, $jid, $nick, %args) This method joins a room. $con should be the AnyEvent::XMPP::IM::Connection object that is to be used to send the necessary stanzas. $jid should be the bare JID of the room. $nick should be your desired nickname in the room. When you successfully entered the room a "enter" event is emitted. In case you created the room, and it is locked, a "locked" event is emitted. Please look in the "EVENTS" section below for more details about how to handle "locked" rooms. (You won't have to care about locked rooms if you didn't disable the "create_instant" flag in %args). If an error occurred and we couldn't join the room, the first two arguments are undef and the third is a AnyEvent::XMPP::Error::MUC object signalling the error. %args hash can contain one of the following keys: timeout => $timeout_in_secs This is the timeout for joining the room. The default timeout is 60 seconds if the timeout is not specified. history => {} Manage MUC-history from XEP-0045 (7.1.16) Hash can contain of the following keys: "chars", "stanzas", "seconds" Example: history => {chars => 0} # don't load history history => {stanzas => 3} # load last 3 history elements history => {seconds => 300, chars => 500} # load history in last 5 minutes, but max 500 characters TODO: add "since" attributes create_instant => $bool If you set $bool to a true value we try to establish an instant room on joining if it doesn't already exist. XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX The default for this flag is true! So if you want to create an reserved room with custom creation in the beginning you have to pass a false value as $bool. PLEASE NOTE: If you set $bool to a false value you have to check the "did_create_room" status flag on your own instance of AnyEvent::XMPP::Ext::MUC::User (provided as the second argument to the callback) to see whether you need to finish room creation! If you don't do this the room may stay LOCKED for ever. See also the "make_instant" and "request_configuration" methods of AnyEvent::XMPP::Ext::MUC. password => $password The password for the room. nickcollision_cb => $cb If the join to the room results in a nickname collision the $cb will be called with the nickname that collided and the return value will be used as alternate nickname and the join is retried. This function is called everytime the nickname collides on join, so you should take care of possible endless retries. get_room ($con, $jid) This returns the AnyEvent::XMPP::Ext::MUC::Room object for the bare part of the $jid if we are joining or have joined such a room. If we are not joined undef is returned. get_rooms ($con) Returns a list of AnyEvent::XMPP::Ext::MUC::Room objects for the connection $con. EVENTS
These are the events that are issued by this MUC extension: $room is the AnyEvent::XMPP::Ext::MUC::Room object which the event belongs to. message => $room, $msg, $is_echo This event is emitted when a message was received from the room. $msg is a AnyEvent::XMPP::Ext::MUC::Message object and $is_echo is true if the message is an echo. NOTE: Please note that some conferences send messages already before you have finished joining a room. That means that you might already get a "message" event for a room that you haven't got an "enter" for event yet. That means that methods like "get_me" might return undef. subject_change => $room, $msg, $is_echo This event is emitted when a user changes the room subject. $msg is a AnyEvent::XMPP::Ext::MUC::Message object and $is_echo is true if the message is an echo. The room subject is the subject of that $msg. subject_change_error => $room, $error If you weren't allowed to change the subject or some other error occurred you will receive this event. $error is a AnyEvent::XMPP::Error::MUC object. error => $room, $error This event is emitted when any error occurred. $error is a AnyEvent::XMPP::Error::MUC object. join_error => $room, $error This event is emitted when a error occurred when joining a room. $error is a AnyEvent::XMPP::Error::MUC object. locked => $room This event is emitted when you disabled the 'create_instant' flag when calling "join_room". It means that you just created a new room, which is locked. You need to configure it before it is unlocked and others can enter. Please consult the methods "make_instant", "request_configuration" and "send_configuration" of AnyEvent::XMPP::Ext::MUC::Room for more information about how to configure a room. NOTE: You won't get another event when you finished configuring the room, so you maybe want to call this on the "AnyEvent::XMPP::Ext::MUC" object when you finished configuring the room successfully: $muc->event (enter => $room, $room->get_me); That could be helpful if you want to place some generic stuff in your "enter" event handlers. NOTE2: If you didn't disable the "create_instant" flag of "join_room" you won't have to care about a "locked" event, as everything will be internally handled for you and you will get an "enter" event if the room is finally setted up. enter => $room, $user This event is emitted when we successfully joined the room. $user is a AnyEvent::XMPP::Ext::MUC::User object which is the user handle for ourself. join => $room, $user This event is emitted when a new user joins the room. $user is the AnyEvent::XMPP::Ext::MUC::User object of that user. nick_change => $room, $user, $oldnick, $newnick This event is emitted when a user changed his nickname. $user is the AnyEvent::XMPP::Ext::MUC::User object of that user. $oldnick is the old nickname and $newnick is the new nickname. presence => $room, $user This event is emitted when a user changes it's presence status (eg. affiliation or role, or away status). $user is the AnyEvent::XMPP::Ext::MUC::User object of that user. part => $room, $user This event is emitted when a user leaves the channel. $user is the AnyEvent::XMPP::Ext::MUC::User of that user, but please note that you shouldn't send any messages to this user anymore. leave => $room, $user This event is emitted when we leave the room. $user is your AnyEvent::XMPP::Ext::MUC::User handle. AUTHOR
Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>" COPYRIGHT &; LICENSE Copyright 2007, 2008 Robin Redeker, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-23 AnyEvent::XMPP::Ext::MUC(3pm)
All times are GMT -4. The time now is 02:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy