Sponsored Content
Top Forums Shell Programming and Scripting Copy data to CSV file from txt output Post 302966053 by adgjmpt on Sunday 7th of February 2016 06:49:25 AM
Old 02-07-2016
Thanks Don the two other fields are also voltages like the output is very long and i am trying figure out bit by bit.

It was really helpful as i am new to bash scripting.

---------- Post updated at 06:49 AM ---------- Previous update was at 06:43 AM ----------

And in the same output i have multiple shelfs and i want the same NE name to be printed beside for the multiple shelfs and adding one column shelf .

Code:
### NE name: AZID1a ###

Trying 172.17.23.132...


   AZID1a 2016-02-03 20:55:30
M  1 COMPLD
   "SHELF-1:SHELF,TEMPERATURE=24C,VOLTAGEA=53034,VOLTAGEB=53402,"
   "SHELF-2:SHELF,TEMPERATURE=26C,VOLTAGEA=53375,VOLTAGEB=53504,"
   "SHELF-3:SHELF,TEMPERATURE=22C,VOLTAGEA=52907,VOLTAGEB=53300,"


spawn telnet 172.17.39.4 3083

### NE name: DAND1b ###

Trying 172.17.39.4...

;
> 
> RTRV-SHELFSTAT:DAND1b::1;

   DAND1b 2016-02-03 20:56:58
M  1 COMPLD
   "SHELF-1:SHELF,TEMPERATURE=25C,VOLTAGEA=53781,VOLTAGEB=53754,"
   "SHELF-2:SHELF,TEMPERATURE=21C,VOLTAGEA=54188,VOLTAGEB=54153,"
   "SHELF-3:SHELF,TEMPERATURE=25C,VOLTAGEA=53838,VOLTAGEB=53926,"
   "SHELF-4:SHELF,TEMPERATURE=21C,VOLTAGEA=53816,VOLTAGEB=53870,"
   "SHELF-5:SHELF,TEMPERATURE=24C,VOLTAGEA=54095,VOLTAGEB=54082,"
   "SHELF-6:SHELF,TEMPERATURE=20C,VOLTAGEA=54081,VOLTAGEB=54106,"
   "SHELF-7:SHELF,TEMPERATURE=34C,VOLTAGEA=52528,VOLTAGEB=53551,"
   "SHELF-8:SHELF,TEMPERATURE=34C,VOLTAGEA=52129,VOLTAGEB=52597,"
   "SHELF-9:SHELF,TEMPERATURE=29C,VOLTAGEA=53840,VOLTAGEB=53870,"
   "SHELF-10:SHELF,TEMPERATURE=25C,VOLTAGEA=53946,VOLTAGEB=53902,"
   "SHELF-11:SHELF,TEMPERATURE=30C,VOLTAGEA=53890,VOLTAGEB=53879,"
   "SHELF-12:SHELF,TEMPERATURE=25C,VOLTAGEA=53121,VOLTAGEB=53126,"
   "SHELF-13:SHELF,TEMPERATURE=25C,VOLTAGEA=53693,VOLTAGEB=53726,"
   "SHELF-14:SHELF,TEMPERATURE=24C,VOLTAGEA=54093,VOLTAGEB=54072,"
   "SHELF-15:SHELF,TEMPERATURE=22C,VOLTAGEA=53749,VOLTAGEB=53783,"
;

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK CSV to TXT format, TXT file not in a correct column format

HI guys, I have created a script to read 1 column in a csv file and then place it in text file. However, when i checked out the text file, it is not in a column format... Example: CSV file contains name,age aa,11 bb,22 cc,33 After using awk to get first column TXT file... (1 Reply)
Discussion started by: mdap
1 Replies

2. Shell Programming and Scripting

select data from oracle table and save the output as csv file

Hi I need to execute a select statement in a solaris environment with oracle database. The select statement returns number of rows of data. I need the data to be inserted into a CSV file with proper format. For that we normally use "You have to select all your columns as one big string,... (2 Replies)
Discussion started by: rdhanek
2 Replies

3. Shell Programming and Scripting

Get Data From CSV File and put into a txt file

Hi Guys, File A I have File A as CSV Format.... No R SS MK Par value S AL A1 PKL123 Lo12 1 S AL A2 PKl123 Lo34 22 S AL A3 PkLK234 Lo67 -34 S AL A4 PkLK235 Lo09 120 S AL A5 PkLK236 Lo76 19 S AL A6 PkLK237 Lo44 -17 S AL A7 PkLK238 Lo90 2 S AL A8 PkLK239 Lo34 -9 I want file B like... (4 Replies)
Discussion started by: asavaliya
4 Replies

4. Shell Programming and Scripting

Copy Data from CSV file to Excel Sheet using Perl

Hi All, Firstly I will like to wish A Happy New Year to all. Now my issue is I have one csv file say(data.csv) and one excel file say(result.xls) The result.xls contains two sheet name Sheet1 and Sheet2, Now What I am trying to do is to First I want to delete that data of Sheet2 if present any,... (6 Replies)
Discussion started by: adisky123
6 Replies

5. UNIX for Dummies Questions & Answers

Need help combining txt files w/ multiple lines into csv single cell - also need data merge

:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux. I am working in Linux terminal. I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies

6. Shell Programming and Scripting

Shell script for .Txt to .csv conversion with data processing

Hi experts, I want to convert a txt file having rows and columns (CNAI_DUMP_raw.txt) by comparing it with another text file (paramaters.txt) and generate a output in CSV which contains only 3rd column from CNAI_DUMP_raw.txt, and the columns mentioned in parameters.txt. FYI: There are two... (16 Replies)
Discussion started by: Gautam Banerjee
16 Replies

7. Shell Programming and Scripting

Desired output.txt for reading txt file using awk?

Dear all, I have a huge txt file (DATA.txt) with the following content . From this txt file, I want the following output using some shell script. Any help is greatly appreciated. Greetings, emily DATA.txt (snippet of the huge text file) 407202849... (2 Replies)
Discussion started by: emily
2 Replies

8. Shell Programming and Scripting

Output large volume of data to CSV file

I have a program that output the ownership and permission on each directory and file on the server to a csv file. I am getting error message when I run the program. The program is not outputting to the csv file. Error: the file access permissions do not allow the specified action cannot... (2 Replies)
Discussion started by: dellanicholson
2 Replies

9. Programming

Python script to run multiple command and append data in output csv file

Experts, I am writing a script and able to write only small piece of code and not able to collect logic to complete this task. In input file have to look for name like like this (BGL_HSR_901_1AG_A_CR9KTR10) before sh iss neors. Record this (BGL_HSR_901_1AG_A_CR9KTR10) in csv file Now have to... (0 Replies)
Discussion started by: as7951
0 Replies
Text::CSV::Encoded::Coder::EncodeGuess(3pm)		User Contributed Perl Documentation	       Text::CSV::Encoded::Coder::EncodeGuess(3pm)

NAME
Text::CSV::Encoded::Coder::EncodeGuess - Text::CSV::Encoded coder class using Encode::Guess SYNOPSIS
use Text::CSV::Encoded coder_class => 'Text::CSV::Encoded::Coder::EncodeGuess'; use Spreadsheet::ParseExcel; my $csv = Text::CSV::Encoded->new(); $csv->encoding( ['ucs2', 'ascii'] ); # guessing ucs2 or ascii? $csv->encoding_to_combine('shiftjis'); my $excel = Spreadsheet::ParseExcel::Workbook->Parse( $file ); my $sheet = $excel->{Worksheet}->[0]; for my $row ( $sheet->{MinRow} .. $sheet->{MaxRow} ) { my @fields; for my $col ( $sheet->{MinCol} .. $sheet->{MaxCol} ) { my $cell = $sheet->{Cells}[$row][$col]; push @fields, $cell->{Val}; } $csv->combine( @fields ) or die; print $csv->string, " "; } DESCRIPTION
This module is inherited from Text::CSV::Encoded::Coder::Encode. USE
Except for 2 attributes, same as Text::CSV::Encoded::Coder::Encode. encoding_in $csv = $csv->encoding_in( $encoding_list_ref ); The accessor to an encoding for pre-parsing CSV strings. If no encoding is given, returns current $encoding, otherwise the object itself. $encoding_list_ref = $csv->encoding_in() When you pass a list reference, it might guess the encoding from the given list. $csv->encoding_in( ['shiftjis', 'euc-jp', 'iso-20022-jp'] ); If it cannot guess the encoding, the first encoding of the list is used. encoding $csv = $csv->encoding( $encoding_list_ref ); $encoding_list_ref = $csv->encoding(); You can pass a list reference to this attribute only: * For list data consumed by combine(). * For list reference returned by getline(). In other word, in "combine" and "print", it might guess an encoding for the passing list data. If it cannot guess the encoding, the first encoding of the list is used. SEE ALSO
Encode, Encode::Guess AUTHOR
Makamaka Hannyaharamitu, <makamaka[at]cpan.org> COPYRIGHT AND LICENSE
Copyright 2008-2010 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-04-26 Text::CSV::Encoded::Coder::EncodeGuess(3pm)
All times are GMT -4. The time now is 01:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy