Sponsored Content
Top Forums Shell Programming and Scripting I must use first sentence from a file to put into variable Post 303002985 by rdrtx1 on Wednesday 6th of September 2017 08:37:56 AM
Old 09-06-2017
Code:
read value x < textfile

 

10 More Discussions You Might Find Interesting

1. AIX

Put one ligne from a file a variable

Hi everybody I looking the put the result of a commane to a Variable i explain here is my command: FJTS_UK:root:common@ukaix3:/> cat sortie | grep "^"| awk '{ print $1}' 15 FJTS_UK:root:common@ukaix3:/> sortie is a texte file I want to put the result of commande in a... (1 Reply)
Discussion started by: kykyboss
1 Replies

2. Shell Programming and Scripting

put the contents of this file into a variable with multiple lines

I have a file that contains the following lines the brown quick fox jumped over the white laze dog 0123456789 I wanted to put the contents of this file into a variable so I used this code: VAR_LIST=`cat $2` where $2 is the file name passed as an argument to the script If I... (3 Replies)
Discussion started by: Nomaad
3 Replies

3. Shell Programming and Scripting

How to put a comment at the begining of the sentence

I have a file shows as below. I would like to put # before CCCC. so how to do in Solaris. Here sed doesnot support -i AAAA BBBB CCCCC DDDDD EEEEE FFFFFF (1 Reply)
Discussion started by: madhusmita
1 Replies

4. Shell Programming and Scripting

Append a sentence in each file.

In a directry there are 100 files are present.... How to append a statement like "Anup Das" in each of the file content, in the first line.... without opening the files.... (2 Replies)
Discussion started by: anupdas
2 Replies

5. UNIX for Dummies Questions & Answers

Script to ask for a sentence and then count number of spaces in the sentence

Hi People, I need some Help to write a unix script that asks for a sentence to be typed out then with the sentence. Counts the number of spaces within the sentence and then echo's out "The Number Of Spaces In The Sentence is 4" as a example Thanks Danielle (12 Replies)
Discussion started by: charlie101208
12 Replies

6. Shell Programming and Scripting

How to put content of file into a variable?

For example, I have a simple text file note: this a note a simple note a very very simple notewhen I use this command, temp=$(cat "note.txt")then I echo temp, the result is in one line. echo $temp note: this a note a simple note a very very simple noteMy variable doesn't have newline. How... (7 Replies)
Discussion started by: 14th
7 Replies

7. Shell Programming and Scripting

Read value of a file, remove first 2 chars and put this value in a variable

Hi i have need of read a file value with cat command and remove first 2character for example cat /sys/class/rtc/day 0x12 Remove char 12 And put this value in a variable is possible with a script thanks for help (6 Replies)
Discussion started by: enaud
6 Replies

8. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

9. Shell Programming and Scripting

Extract sentence and its details from a text file based on another file of sentences

Hi I have two text files. The first file is TEXTFILEONE.txt as given below: <Text Text_ID="10155645315851111_10155645333076543" From="460350337461111" Created="2011-03-16T17:05:37+0000" use_count="123">This is the first text</Text> <Text Text_ID="10155645315851111_10155645317023456"... (7 Replies)
Discussion started by: my_Perl
7 Replies

10. Shell Programming and Scripting

Problem to match a path in a file and put it into a variable

Hello,:p I made a script which do a backup on remote servers with a rsync command. I have a config.cfg with the IPs and the paths where it will copy the directory. The problem is that it doesn't match the paths, So, here my script and its output with the debug : #!/bin/bash # PATHS... (7 Replies)
Discussion started by: Arnaudh78
7 Replies
Reflow(3pm)						User Contributed Perl Documentation					       Reflow(3pm)

NAME
Text::Reflow - Perl module for reflowing text files using Knuth's paragraphing algorithm. SYNOPSIS
use Text::Reflow qw(reflow_file reflow_string reflow_array); reflow_file($infile, $outfile, key => value, ...); $output = reflow_string($input, key => value, ...); $output = reflow_array(@input, key => value, ...); DESCRIPTION
These routines will reflow the paragraphs in the given file, filehandle, string or array using Knuth's paragraphing algorithm (as used in TeX) to pick "good" places to break the lines. Each routine takes ascii text data with paragraphs separated by blank lines and reflows the paragraphs. If two or more lines in a row are "indented" then they are assumed to be a quoted poem and are passed through unchanged (but see below) The reflow algorithm tries to keep the lines the same length but also tries to break at punctuation, and avoid breaking within a proper name or after certain connectives ("a", "the", etc.). The result is a file with a more "ragged" right margin than is produced by "fmt" or "Text::Wrap" but it is easier to read since fewer phrases are broken across line breaks. For "reflow_file", if $infile is the empty string, then the input is taken from STDIN and if $outfile is the empty string, the output is written to STDOUT. Otherwise, $infile and $outfile may be a string, a FileHandle reference or a FileHandle glob. A typical invocation is: reflow_file("myfile", ""); which reflows the whole of myfile and prints the result to STDOUT. KEYWORD OPTIONS The behaviour of Reflow can be adjusted by setting various keyword options. These can be set globally by referencing the appropriate variable in the Text::Reflow package, for example: $Text::Reflow::maximum = 80; $Text::Reflow::optimum = 75; will set the maximum line length to 80 characters and the optimum line length to 75 characters for all subsequent reflow operations. Or they can be passed to a reflow_ function as a keyword parameter, for example: $out = reflow_string($in, maximum => 80, optimum => 75); in which case the new options only apply to this call. The following options are currently implemented, with their default values: optimum => [65] The optimum line length in characters. This can be either a number or a reference to an array of numbers: in the latter case, each optimal line length is tried in turn for each paragraph, and the one which leads to the best overall paragraph is chosen. This results in less ragged paragraphs, but some paragraphs will be wider or narrower overall than others. maximum => 75 The maximum allowed line length. indent => "" Each line of output has this string prepended. "indent => string" is equivalent to "indent1 => string, indent2 => string". indent1 => "" A string which is used to indent the first line in any paragraph. indent2 => "" A string which is used to indent the second and subsequent line in any paragraph. quote => "" Characters to strip from the beginning of a line before processing. To reflow a quoted email message and then restore the quotes you might want to use quote => "> ", indent => "> " skipto => "" Skip to the first line starting with the given pattern before starting to reflow. This is useful for skipping Project Gutenberg headers or contents tables. skipindented => 2 If "skipindented" = 0 then all indented lines are flowed in with the surrounding paragraph. If "skipindented" = 1 then any indented line will not be reflowed. If "skipindented" = 2 then any two or more adjacent indented lines will not be reflowed. The purpose of the default value is to allow poetry to pass through unchanged, but not to allow a paragraph indentation from preventing the first line of the paragraph from being reflowed. noreflow => "" A pattern to indicate that certain lines should not be reflowed. For example, a table of contents might have a line of dots. The option: noreflow => '(.s*){4}.' will not reflow any lines containing five or more consecutive dots. frenchspacing => 'n' Normally two spaces are put at the end of a sentance or a clause. The "frenchspacing" option (taken from the TeX macro of the same name) disables this feature. oneparagraph => 'n' Set this to 'y' if you want the whole input to be flowed into a single paragraph, ignoring blank lines in the input. semantic => 30 This parameter indicates the extent to which semantic factors matter (breaking on punctuation, avoiding a break within a clause etc.). Set this to zero to minimise the raggedness of the right margin, at the expense of readability. namebreak => 10 Penalty for splitting up a name sentence => 20 Penalty for sentence widows and orphans (ie splitting a line immediately after the first word in a sentence, or before the last word in a sentence) independent => 10 Penalty for independent clause widows and orphans. dependent => 6 Penalty for dependent clause widows and orphans. shortlast => 5 Penalty for a short last line in a paragraph (one or two words). connpenalty => 1 Multiplier for the "negative penalty" for breaking at a connective. In other words, increasing this value makes connectives an even more attractive place to break a line. EXPORT None by default. AUTHOR
Original "reflow" perl script written by Michael Larsen, larsen@edu.upenn.math. Modified, enhanced and converted to a perl module with XSUB by Martin Ward, martin@gkc.org.uk SEE ALSO
perl(1). See "TeX the Program" by Donald Knuth for a description of the algorithm used. perl v5.14.2 2011-11-15 Reflow(3pm)
All times are GMT -4. The time now is 12:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy