Sponsored Content
Top Forums Shell Programming and Scripting rearrange info of file in a "table" Post 302204733 by csecnarf on Thursday 12th of June 2008 11:06:41 AM
Old 06-12-2008
rearrange info of file in a "table"

Please I need to rearrange data acquired by USB port from a sensor network. The information is mixed and I need to convert it into a kind of table. This is my input file:

Node 4D5A joined
Temperature: 27,5
Humidity: 40
Dew Point: 23
No motion detected
LUX: 389
Temperature: 28
Humidity: 41
Dew Point: 21
Node 58DF joined
Temperature: 28,5
Humidity: 41
Dew Point: 24
LUX: 384
Node 4D5A joined
Temperature: 21,5
Humidity: 43
Dew Point: 20
No motion detected

Realize that every time a node send info, first is sent its ID and later different data without any specific pattern. My idea is to identify every line between Node and Node and arrange them into other file. Any pattern is posible... but I don't have any idea on how to implement it. I have been trying with awk, sed, grep... but with no result.

A possible solution could be like this:

Node:data:value
Node:data:value

or

Node
Data:value
Node
Data:value

please give some ideas or solutions Smilie

Thanks a lot!
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how do I dump "info ls" to a file?

how do I dump "info ls" to a file? I did $info ls >a <ENTER> but it didn't dump the whole thing. It only dumped chapter 10. (4 Replies)
Discussion started by: james hanley
4 Replies

2. UNIX for Advanced & Expert Users

Help, filtering some info. from a file under "()"

I HAVE A FILE "TEXT.TXT" WHICH CONTAINS FOLLOWING : CHANNEL(SYSTEM.DEF.CLUSRCVR) CHLTYPE(CLUSRCVR) CHANNEL(TO.XYZ) CHLTYPE(CLUSRCVR) NOW I WANT THE NAMES WRITTEN BETWEEN THE BRACES () UNDER COLUMN ONE, THAT IS, TO.XYZ and SYSTEM.DEF.CLUSRCVR.... (10 Replies)
Discussion started by: varungupta
10 Replies

3. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

4. HP-UX

Need to identify the process/app which is triggering the error "vmunix: file: table is full"

Hi, I'm seeing the error vmunix: file: table is full in syslog.log. Although changing the value of the kernel parameter nfile would make this error go away, how would I identify which process/application in the server is triggering this error? The server is a HP-UX B.11.11. Thanks in advance! (1 Reply)
Discussion started by: enchogas
1 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

7. UNIX for Advanced & Expert Users

AIX - io info get from "libperfstat" not match "iostat"

Hi, everyone. I need to write a program to get io info based on libperfstat. But the "write time" of a disk is just half of the value get from iostat. I'm confused and can't explain. Help please. How I calculate "write service time per sec": In iostat: write service... (0 Replies)
Discussion started by: jackliang
0 Replies

8. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
XPath::Node(3)						User Contributed Perl Documentation					    XPath::Node(3)

NAME
XML::XPath::Node - internal representation of a node API
The Node API aims to emulate DOM to some extent, however the API isn't quite compatible with DOM. This is to ease transition from XML::DOM programming to XML::XPath. Compatibility with DOM may arise once XML::DOM gets namespace support. new Creates a new node. See the sub-classes for parameters to pass to new(). getNodeType Returns one of ELEMENT_NODE, TEXT_NODE, COMMENT_NODE, ATTRIBUTE_NODE, PROCESSING_INSTRUCTION_NODE or NAMESPACE_NODE. UNKNOWN_NODE is returned if the sub-class doesn't implement getNodeType - but that means something is broken! The constants are exported by default from XML::XPath::Node. The constants have the same numeric value as the XML::DOM versions. getParentNode Returns the parent of this node, or undef if this is the root node. Note that the root node is the root node in terms of XPath - not the root element node. to_sax ( $handler | %handlers ) Generates sax calls to the handler or handlers. See the PerlSAX docs for details (not yet implemented correctly). MORE INFO
See the sub-classes for the meaning of the rest of the API: o XML::XPath::Node::Element o XML::XPath::Node::Attribute o XML::XPath::Node::Namespace o XML::XPath::Node::Text o XML::XPath::Node::Comment o XML::XPath::Node::PI perl v5.16.2 2003-01-26 XPath::Node(3)
All times are GMT -4. The time now is 11:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy