Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Strange error: grep does not read from file Post 302557103 by vbe on Tuesday 20th of September 2011 11:44:53 AM
Old 09-20-2011
Corona688:
You are absolutely right but that, our member already knows and tried ( see the beginning of thread...and I also sugggested was better...) but what he could not understand what was incorrect in his example giving a
Code:
read VAR <a file>

Maybe could you explain to our guest the reason or how works the redirection ( I wonder if its not there the confusion - where in input using < you specify a file, but doesnt work with read <variable> file...)

Last edited by vbe; 09-20-2011 at 12:54 PM.. Reason: addendum : task for corona688 if he accepts...
 

10 More Discussions You Might Find Interesting

1. AIX

Strange error with file access permissions

All, I am trying to copy some data from /admin/reports/Sept/ccn/c_ivsstr01 to /home/users/myhomedir and I am getting an error I have never seen before: The file access permissions do not allow the specified action. The permissions on the file are -rw-r--r-- and I am the owner of the file... (3 Replies)
Discussion started by: kjbaumann
3 Replies

2. Shell Programming and Scripting

Read file then grep the line

Dear all, I am reading a file that has 1 column. While reading I must find the line references from the another file. The following shell doesn't works. Please help #!/bin/bash while read filename; do grep ${filename} fs_full.dat >> unprocfull.dat; done < unproc.dat But when... (2 Replies)
Discussion started by: mr_bold
2 Replies

3. UNIX for Advanced & Expert Users

Strange read "error"

Good day. I really hope U can help me with this as I'm stumped! In the command line eg: read X; echo $x . Works perfectly fine. Then running the same thing in my script it sometimes exiqute immediatly after pressing enter and continuiing. Not exiting the script I re-run the "read" section.... (1 Reply)
Discussion started by: Blooper1980
1 Replies

4. Shell Programming and Scripting

read in variable data from another file - grep

Hello! I think this should be an easy solution. I have a large file with many fields of data. The first field has a unique identifier (a subject number) for every record for a chunk of data. Something like this: There were ten experimental conditions (ec), but the ec is identified by only... (11 Replies)
Discussion started by: ccox85
11 Replies

5. Shell Programming and Scripting

Strange error while splitting a file

Hi folks I am facing a strange error while splitting a '|' delimited file 'file1' based on column '3'. (File is 40 columns wide). I wish to create as many files 'file_n' from the file 'file1' as distinct values of the column '3'; in 'file1' eg: file1: qwe|qweqw|123|fg... (3 Replies)
Discussion started by: powerslave
3 Replies

6. Shell Programming and Scripting

Grep a file that may contain strange characters

Hello unix users :) I am trying to grep a string from a file that both the file and the string may have characters in them that are quite... strange, like würzburger. Well, bash reads this as W%C3%BCrzburger For example, if i do wget W%C3%BCrzburger the output is: --2012-01-08... (2 Replies)
Discussion started by: hakermania
2 Replies

7. Shell Programming and Scripting

read from file and grep using shell

Hi Guys, I have a small script which greps for the username reading from stdinput. ./file.sh pattern pattern=$1 grep "blah blah.*$pattern" /home/user/log.txt Instead of typing the pattern everytime i want to read the pattern from a file inside the shell script and execute the... (5 Replies)
Discussion started by: Irishboy24
5 Replies

8. UNIX for Beginners Questions & Answers

Read a file and send mail based on grep

Hi All, I am having a job and I need to send email when the job is running. On any other case (success,fail) I don't needed to send email. I check with BMC they told they dont have that in the version I am using. So I created a dependent job and grepped for the status and sent email. My... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

9. Shell Programming and Scripting

How to read each file grep a value from that?

Hi Team, in /tmp folder i have thousands of log files i want to read each file and grep a value called "Calling This". Each logfile name is different but it ends with .log. How can i achieve this? Please excuse if i did any mistake by not following forum standards. I will surely follow... (10 Replies)
Discussion started by: darling
10 Replies

10. UNIX for Advanced & Expert Users

Need help for faster file read and grep in big files

I have a very big input file <inputFile1.txt> which has list of mobile no inputFile1.txt 3434343 3434323 0970978 85233 ... around 1 million records i have another file as inputFile2.txt which has some log detail big file inputFile2.txt afjhjdhfkjdhfkd df h8983 3434343 | 3483 | myout1 |... (3 Replies)
Discussion started by: reldb
3 Replies
tifftopnm(1)                                                  General Commands Manual                                                 tifftopnm(1)

NAME
tifftopnm - convert a TIFF file into a portable anymap SYNOPSIS
tifftopnm [-alphaout={alpha-filename,-}] [-headerdump] [-respectfillorder] [tiff-filename] You may abbreviate any option to its shortest unique prefix. You may use two hyphens instead of one in options. You may separate an option and its value either by an equals sign or white space. DESCRIPTION
Reads a TIFF file as input. Produces a portable anymap as output. The type of the output file depends on the input file - if it's black & white, generates a pbm file; if it's grayscale, generates a pgm file; otherwise, a ppm file. The program tells you which type it is writ- ing. This program cannot read every possible TIFF file -- there are myriad variations of the TIFF format. However, it does understand mono- chrome and gray scale, RGB, RGBA (red/green/blue with alpha channel), CMYK (Cyan-Magenta-Yellow-Black ink color separation), and color pal- ette TIFF files. An RGB file can have either single plane (interleaved) color or multiple plane format. The program reads 1-8 and 16 bit- per-sample input, the latter in either bigendian or littlendian encoding. Tiff directory information may also be either bigendian or lit- tendian. One reason this program isn't as general as TIFF programs often are is that it does not use the TIFFRGBAImageGet() function of the TIFF library to read TIFF files. Rather, it uses the more primitive TIFFReadScanLine() function and decodes it itself. There is no fundamental reason that this program could not read other kinds of TIFF files; the existing limitations are mainly because no one has asked for more. The PNM output has the same maxval as the Tiff input, except that if the Tiff input is colormapped (which implies a maxval of 65535) the PNM output has a maxval of 255. Though this may result in lost information, such input images hardly ever actually have more color resolu- tion than a maxval of 255 provides and people often cannot deal with PNM files that have maxval > 255. By contrast, a non-colormapped Tiff image that doesn't need a maxval > 255 doesn't have a maxval > 255, so when we see a non-colormapped maxval > 255, we take it seriously and produce a matching output maxval. The tiff-filename argument names the regular file that contains the Tiff image. If you specify "-" or don't specify this argument, tfftopnm uses Standard Input. In either case, the file must be seekable. That means no pipe, but any regular file is fine. OPTIONS
-alphaout=alpha-filename tifftopnm creates a PGM (portable graymap) file containing the alpha channel values in the input image. If the input image doesn't contain an alpha channel, the alpha-filename file contains all zero (transparent) alpha values. If you don't specify -alphaout, tifftopnm does not generate an alpha file, and if the input image has an alpha channel, tifftopnm simply discards it. If you specify - as the filename, tifftopnm writes the alpha output to Standard Output and discards the image. See pnmcomp(1) for one way to use the alpha output file. -respectfillorder By default, tifftopnm ignores the "fillorder" tag in the TIFF input, which means it may incorrectly interpret the image. To make it follow the spec, use this option. For a lengthy but engaging discussion of why tifftopnm works this way and how to use the -respectfillorder option, see the note on fillorder below. -headerdump Dump TIFF file information to stderr. This information may be useful in debugging TIFF file conversion problems. All options can be abbreviated to their shortest unique prefix. NOTES
Fillorder There is a piece of information in the header of a TIFF image called "fillorder." The TIFF specification quite clearly states that this value tells the order in which bits are arranged in a byte in the description of the image's pixels. There are two options, assuming that the image has a format where more than one pixel can be represented by a single byte: 1) the byte is filled from most signficant bit to least signficant bit going left to right in the image; and 2) the opposite. However, there is confusion in the world as to the meaning of fillorder. Evidence shows that some people believe it has to do with byte order when a single value is represented by two bytes. These people cause TIFF images to be created that, while they use a MSB-to-LSB fillorder, have a fillorder tag that says they used LSB-to- MSB. A program that properly interprets a TIFF image will not end up with the image that the author intended in this case. For a long time, tifftopnm did not understand fillorder itself and assumed the fillorder was MSB-to-LSB regardless of the fillorder tag in the TIFF header. And as far as I know, there is no legitimate reason to use a fillorder other than MSB-to-LSB. So users of tifftopnm were happily using those TIFF images that had incorrect fillorder tags. So that those users can continue to be happy, tifftopnm today continues to ignore the fillorder tag unless you tell it not to. (It does, however, warn you when the fillorder tag does not say MSB-to-LSB that the tag is being ignored). If for some reason you have a TIFF image that actually has LSB-to-MSB fillorder, and its fillorder tag correctly indicates that, you must use the -respectfillorder option on tifftopnm to get proper results. Examples of incorrect TIFF images are at ftp://weather.noaa.gov. They are apparently created by a program called faxtotiff. This note was written on January 1, 2002. SEE ALSO
pnmtotiff(1), pnmtotiffcmyk(1), pnmcomp(1), pnm(5) AUTHOR
Derived by Jef Poskanzer from tif2ras.c, which is Copyright (c) 1990 by Sun Microsystems, Inc. Author: Patrick J. Naughton (naughton@wind.sun.com). 02 April 2000 tifftopnm(1)
All times are GMT -4. The time now is 01:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy