Sponsored Content
Top Forums Shell Programming and Scripting Issues with Reading Line by line from a file Post 302470948 by 116@434 on Thursday 11th of November 2010 12:19:42 PM
Old 11-11-2010
There are two attempts to read the file. I see two read -r var in the above output. Can you check if the input file is in correct format. Or maybe some junk character is present.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading a file line by line and processing for each line

Hi, I am a beginner in shell scripting. I have written the following script, which is supposed to process the while loop for each line in the sid_home.txt file. But I'm getting the 'end of file' unexpected for the last line. The file sid_home.txt gets generated as expected, but the script... (6 Replies)
Discussion started by: sagarparadkar
6 Replies

2. Shell Programming and Scripting

KSH: Reading a file line by line into multiple arrays

Hi - I have a file that contains data in this format:- #comment value1 value2 value3 #comment value4 value5 value6 value7 #comment value8 value9 I need to read value1, value2 and value3 into one array, value4 value5 value6 and value7 into another array and value8 and value9 into a 3rd... (2 Replies)
Discussion started by: sniper57
2 Replies

3. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

4. UNIX for Dummies Questions & Answers

Parsing file, reading each line to variable, evaluating date/time stamp of each line

So, the beginning of my script will cat & grep a file with the output directed to a new file. The data I have in this file needs to be parsed, read and evaluated. Basically, I need to identify the latest date/time stamp and then calculate whether or not it is within 15 minutes of the current... (1 Reply)
Discussion started by: hynesward
1 Replies

5. Shell Programming and Scripting

How to start reading from the nth line till the last line of a file.

Hi, For my reuirement, I have to read a file from the 2nd line till the last line<EOF>. Say, I have a file as test.txt, which as a header record in the first line followed by records in rest of the lines. for i in `cat test.txt` { echo $i } While doing the above loop, I have read... (5 Replies)
Discussion started by: machomaddy
5 Replies

6. Shell Programming and Scripting

Reading text file, comparing a value in a line, and placing only part of the line in a variable?

I need some help. I would like to read in a text file. Take a variable such as ROW-D-01, compare it to what's in one line in the text file such as PROD/VM/ROW-D-01 and only input PROD/VM into a variable without the /ROW-D-01. Is this possible? any help is appreciated. (2 Replies)
Discussion started by: xChristopher
2 Replies

7. Shell Programming and Scripting

Comparison of fields then increment a counter reading line by line in a file

Hi, i have a scenario were i should compare a few fields from each line then increment a variable based on that. Example file 989878|8999|Y|0|Y|N|V 989878|8999|Y|0|N|N|V 989878|8999|Y|2344|Y|N|V i have 3 conditions to check and increment a variable on every line condition 1 if ( $3... (4 Replies)
Discussion started by: selvankj
4 Replies

8. Shell Programming and Scripting

Reading line by line from live log file using while loop and considering only those lines start from

Hi, I want to read a live log file line by line and considering those line which start from time stamp; Below code I am using, which read line but throws an exception when comparing line that does not contain error code tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Discussion started by: ketanraut
2 Replies

9. UNIX for Beginners Questions & Answers

Reading a file line by line and print required lines based on pattern

Hi All, i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field. i am using centos 7 Operating system. want to read below file. # cat /tmp/d5 NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies
html2text(1)						      General Commands Manual						      html2text(1)

NAME
html2text - an advanced HTML-to-text converter SYNOPSIS
html2text -help html2text -version html2text [ -unparse | -check ] [ -debug-scanner ] [ -debug-parser ] [ -rcfile path ] [ -style ( compact | pretty ) ] [ -width width ] [ -o output-file ] [ -nobs ] [ -ascii | -utf8 ] [ -nometa ] [ input-url ... ] DESCRIPTION
html2text reads HTML documents from the input-urls, formats each of them into a stream of plain text characters, and writes the result to standard output (or into output-file, if the -o command line option is used). If no input-urls are specified on the command line, html2text reads from standard input. A dash as the input-url is an alternate way to specify standard input. html2text understands all HTML 3.2 constructs, but can render only part of them due to the limitations of the text output format. However, the program attempts to provide good substitutes for the elements it cannot render. html2text parses HTML 4 input, too, but not always as successful as other HTML processors. It also accepts syntactically incorrect input, and attempts to interpret it "reasonably". The way html2text formats the HTML documents is controlled by formatting properties read from an RC file. html2text attempts to read $HOME/.html2textrc (or the file specified by the -rcfile command line option); if that file cannot be read, html2text attempts to read /etc/html2textrc. If no RC file can be read (or if the RC file does not override all formatting properties), then "reasonable" defaults are assumed. The RC file format is described in the html2textrc(5) manual page. Debian version of html2text also can do input and output recoding (see /usr/share/doc/html2text/README.Debian for more info). html2text tries to fetch encoding from HTML document. If encoding is not specified, you can use -ascii and -utf8 options. Output is converted to user's locale charset (LC_CTYPE). OPTIONS
-nometa By default, Debian version of html2text use 'meta http-equiv' tag for input recoding. This option cancels this behavior. -ascii By default, when -nometa is supplied, html2text uses UTF-8 for the output. Specifying this option, plain ASCII is used instead. To find out how non-ASCII characters are rendered, refer to the file "ascii.substitutes". -utf8 By default, when -nometa is supplied, html2text uses ISO 8859-1 for the input. Specifying this option, UTF-8 is used instead (both for input and output). This option implies -nobs. -check This option is for diagnostic purposes: The HTML document is only parsed and not processed otherwise. In this mode of operation, html2text will report on parse errors and scan errors, which it does not in other modes of operation. Note that parse and scan errors are not fatal for html2text, but may cause mis-interpretation of the HTML code and/or portions of the document being swal- lowed. -debug-parser Let html2text report on the tokens being shifted, rules being applied, etc., while scanning the HTML document. This option is for diagnostic purposes. -debug-scanner Let html2text report on each lexical token scanned, while scanning the HTML document. This option is for diagnostic purposes. -help Print command line summary and exit. -nobs By default, original html2text renders underlined letters with sequences like "underscore-backspace-character" and boldface letters like "character-backspace-character". Because of issues with UTF-8, Debian version of html2text doesn't produce backspaces, so this option really does nothing. -o output-file Write the output to output-file instead of standard output. A dash as the output-file is an alternate way to specify the standard output. -rcfile path Attempt to read the file specified in path as RC file. -style ( compact | pretty ) Style pretty changes some of the default values of the formatting parameters documented in html2textrc(5). To find out which and how the formatting parameter defaults are changed, check the file "pretty.style". If this option is omitted, style compact is assumed as default. -unparse This option is for diagnostic purposes: Instead of formatting the parsed document, generate HTML code, that is guaranteed to be syn- tactically correct. If html2text has problems parsing a syntactically incorrect HTML document, this option may help you to under- stand what html2text thinks that the original HTML code means. -version Print program version and exit. -width width By default, html2text formats the HTML documents for a screen width of 79 characters. If redirecting the output into a file, or if your terminal has a width other than 80 characters, or if you just want to get an idea how html2text deals with large tables and different terminal widths, you may want to specify a different width. FILES
/etc/html2textrc System wide parser configuration file. $HOME/.html2textrc Personal parser configuration file, overrides the system wide values. CONFORMING TO
HTML 3.2 (HTML 3.2 Reference Specification - http://www.w3.org/TR/REC-html32), RESTRICTIONS
Debian version of html2text have no http support. Use html2text through pipes with curl or wget instead. See README.Debian for more infor- mation. html2text was written to convert HTML 3.2 documents. When using it with HTML 4 or even XHTML 1 documents, some constructs present only in these HTML versions might not be rendered. AUTHOR
html2text was written up to version 1.2.2 by Arno Unkrig <arno@unkrig.de> for GMRS Software GmbH, Unterschleissheim. Current maintainer and primary download location is: Martin Bayer <mail@mbayer.de> http://www.mbayer.de/html2text/files.shtml This man page was modified for Debian by Eugene V. Lyubimkin <jackyf.devel@gmail.com> <> SEE ALSO
html2textrc(5), less(1), more(1) 2008-09-20 html2text(1)
All times are GMT -4. The time now is 08:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy