Sponsored Content
Top Forums Shell Programming and Scripting Parsing of file for Report Generation (String parsing and splitting) Post 302292396 by cfajohnson on Friday 27th of February 2009 05:37:14 PM
Old 02-27-2009
Quote:
Originally Posted by adderek
If the line can be very long you could expect unexpected problems (like storing too much data into a variable in shell or the line being truncated).

There is no reason either should happen. The variable length is limited only by available memory.
Quote:

On the other side such trick could probably work as well: "for var in $(cat file); do .... done"

The is not the way to read a file. It sets var to each word in the file, not each line.
Quote:
or better - use "read".... you might need to play with the FS/IFS settings.

There is no need to play with IFS to read a file line by line.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

parsing a string

hi i am new to shelll scripting I need to parse a string like "abc,def,ghie,jkl" And assign them to some variables like hs1 = abc hs2 = def hs3 = ghi hs4 = jkl Please help (4 Replies)
Discussion started by: satish@123
4 Replies

2. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies

3. Shell Programming and Scripting

Parsing out the logs and generating report

My file will contain following(log.txt): start testcase: config loading ...... error XXXX ..... end testcase: config loading, result failed start testcase: ping check ..... error ZZZZZ ..... error AAAAA end testcase: Ping check, result failed I am expecting below output. ... (4 Replies)
Discussion started by: shellscripter
4 Replies

4. Shell Programming and Scripting

String-parsing!

I need the perl solution for the following : $string="I LOVE INDIA" now, in a new string i need the first character of each word... that is string2 should be "ILN". (10 Replies)
Discussion started by: vijay_0209
10 Replies

5. Shell Programming and Scripting

String parsing

Hi, name=VDSL_TTV_ HN_SUB create coid=MA5603U phone=5678 portpolicy=APortSelectionPolicy rfu10=TTV rfu3=Dot1q sz7_portmode=VDSL2 rfu5=1234 srprofile.sy_profname=$ADSL_TTV_SubProfile1 I have a line like this. Its a single line.I need the output as name=VDSL_TTV_ HN_SUB create... (1 Reply)
Discussion started by: giri_luck
1 Replies

6. Shell Programming and Scripting

Need help on parsing string

for i in `cat list`;do lol=`curl -m 2 -s ${i} | grep 'class=info' | cut -d '>' -f14 | cut -d '<' -f1 | sed '/^$/d'`; if ;then echo "$i,$lol" >> dirty; echo "$i,$lol";fi; done cut: you must specify a list of bytes, characters, or fields Try `cut --help' for more information. it gave me that... (0 Replies)
Discussion started by: p33plime
0 Replies

7. Shell Programming and Scripting

Parsing a long string string problem for procmail

Hi everyone, I am working on fetchmail + procmail to filter mails and I am having problem with parsing a long line in the body of the email. Could anyone help me construct a reg exp for this string below. It needs to match exactly as this string. GetRyt... (4 Replies)
Discussion started by: cwiggler
4 Replies

8. Shell Programming and Scripting

Parsing diff output into report

Hello all; lat week I was able to get some assistance on creating a summary report from a file generated by a "comm" comparison of twp CSV files...turn out now that I am being asked for a detail report as well...this is beyond my knowledge of perl (and yes I have to use perl)..also please keep... (5 Replies)
Discussion started by: gvolpini
5 Replies

9. UNIX for Dummies Questions & Answers

Help on parsing Oracle RMAN output for string and print sections of a file

Hi, I need some advise on how to print 'sections' of the attached file. I am searching for some that says Marked Corrupt and print some lines after it. At the moment I am running the command below: sed -n -e '/Marked Corrupt/{N;N;p;}' rman_list_validate.txtThis gives me the following... (1 Reply)
Discussion started by: newbie_01
1 Replies

10. Shell Programming and Scripting

Parsing a log file and creating a report script

The log file is huge and lot of information, i would like to parse and make a report . below is the log file looks like: REPORT DATE: Mon Aug 10 04:16:17 CDT 2017 SYSTEN VER: v1.3.0.9 TERMINAL TYPE: prod SYSTEM: nb11cu51 UPTIME: 04:16AM up 182 days 57 mins min MODEL, TYPE, and SN:... (8 Replies)
Discussion started by: amir07
8 Replies
FBB::Manipulators(3bobcat)                                         Manipulators                                         FBB::Manipulators(3bobcat)

NAME
FBB::Manipulators - Manipulators defined in the FBB namespace DESCRIPTION
Various manipulators are defined within the FBB namespace. This manual page provides an overview of the manipulators that are currently defined in the FBB namespace. MANIPULATORS
o FBB::center: defined in bobcat/align This manipulator can be specified when constructing an FBB::Align object to indicate that a table column should center its contents. o FBB::decindent: defined in bobcat/indent This manipulator reduces the indentation level. o FBB::def: defined in bobcat/table This manipulator `completes' a Table object to a full rectangular object. It can be inserted into a Table object. o FBB::err: defined in bobcat/msg Generates an error message. o FBB::fatal: defined in bobcat/msg Generates a fatal message, followed by an Errno(1) exception. o FBB::fs: defined in bobcat/tablebuf Starts the definition of the next element in a table. o FBB::info: defined in bobcat/msg Generates an informational message. o FBB::incindent: defined in bobcat/indent This manipulator will increment the indentation level. o FBB::indent: defined in bobcat/indent This manipulator inserts the currently defined number of indentation blanks into an ostream. o FBB::indentdec: defined in bobcat/indent This manipulator will insert, then reduce the indentation level. o FBB::indentinc: defined in bobcat/indent This manipulator will insert, then increment the indentation level. o FBB::lm: defined in bobcat/ofoldstreambuf This manipulator sets the left margin of FBB::OFoldStream objects. o FBB::mlm: defined in bobcat/ofoldstreambuf This manipulator modifies (alters) the left margin of FBB::OFoldStream objects. o FBB::nlindent: defined in bobcat/indent This manipulator will insert a newline, then indent. o FBB::rs: defined in bobcat/tablebuf Starts the definition of the next row in a table. o FBB::spool: defined in bobcat/msg Generates a (partial) informational message. o FBB::warning: defined in bobcat/msg Generates a warning message. SEE ALSO
bobcat(7), columnwidth(3bobcat), equalwidth(3bobcat), errno(3bobcat), indent(3bobcat), lm(3bobcat), mlm(3bobcat), msg(3bobcat), table(3bob- cat) BUGS
None Reported. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::Manipulators(3bobcat)
All times are GMT -4. The time now is 07:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy