02-28-2012
Replacing all cells that have a specific value in a text file
I have a space delimited text file where I want to replace all cells that are 0 with NA. However I cannot simply use 'sed/0/NA/g' because there are other 0's in the text file that are part of numbers.
Example input:
896.933464285715
0
874.691732142857
866.404660714286
Output:
896.933464285715
NA
874.691732142857
866.404660714286
How do I go about doing that? Thanks!
10 More Discussions You Might Find Interesting
1. HP-UX
i have a file that looks like this:
000000112/01/2008 D99999
000000 12/01/2008 D99999
000000 12/01/2008 1D99999
i need to replace the blanks into 1 for column 7,18-19
how can this be achieved using awk?
Thanks. (1 Reply)
Discussion started by: zeontman
1 Replies
2. Shell Programming and Scripting
Hi ,
i have one file like :
APP101A
APP103B
MSG307A
MSG308B
XADM002A
and so on , and i expect to replace the last character A by B and B by A
the result would be :
APP101B
APP103A
MSG307B
MSG308A
XADM002B
how can i do that ? (3 Replies)
Discussion started by: Nicol
3 Replies
3. Shell Programming and Scripting
Hi ,
I'm so surprised to see my thread closed !
i come here many times and work with some great guys like Perderabo , each time i search for many solutions to write some scripts for my job , at this time i don't see how i can solve this one , so please don't take me as a pupil !
i can test... (16 Replies)
Discussion started by: Nicol
16 Replies
4. UNIX for Dummies Questions & Answers
I have this space delimited large text file with more than 1,000,000+ columns and about 100 rows. I want to delete all the cells that consist of just 2 (leave 2's that are not by themselves intact):
File before modification
aa bb cc 2 NA100 dd
aa b1 c2 2 NA102 de
File after modification... (1 Reply)
Discussion started by: evelibertine
1 Replies
5. UNIX for Dummies Questions & Answers
How do you delete cells from a space delimited text file given row and column number? Letś say the row number is r and the column number is c. Thanks! (5 Replies)
Discussion started by: evelibertine
5 Replies
6. UNIX for Dummies Questions & Answers
I have a text file in the following format:
13412 NA06985 0 0 2 46.6432798439 4 4 4 4
13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4
13412 NA06993 0 0 1 45.8022601455 4 4 2 4
13401 NA06994 0 0 1 48.780669145 4 4 4 4
13401 NA07000 0 0 2 47.7312017846 2 4 4 4
13402 NA07019... (3 Replies)
Discussion started by: evelibertine
3 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I have a text file in the following format:
Code:
13412 NA06985 0 0 2 46.6432798439 4 4 4 4
13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4
13412 NA06993 0 0 1 45.8022601455 4 4 2 4
13401 NA06994 0 0 1 48.780669145 4 4 4 4
13401 NA07000 0 0 2 47.7312017846 2 4 4 4 ... (2 Replies)
Discussion started by: evelibertine
2 Replies
8. UNIX for Dummies Questions & Answers
How do you grep cells that contain a specific string. I tried grep but it greps the whole line and not just the cells. Thanks! (4 Replies)
Discussion started by: evelibertine
4 Replies
9. Shell Programming and Scripting
Hi
This is my first post and I'm just a beginner. So please be nice to me.
I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file?
I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies
10. Shell Programming and Scripting
Greetings.
I've got a csv file with data along these lines:
Spumoni's Pizza Place, Placemats n Things, Just Lamps
Counterfeit Dollars by Vinnie, Just Shades, Dollar StoreI want to replace the entire comma-delimited field if it matches something ending in "Place" or beginning with "Dollar",... (2 Replies)
Discussion started by: palmfrond
2 Replies
LEARN ABOUT DEBIAN
genprism
GENPRISM(1) General Commands Manual GENPRISM(1)
NAME
genprism - generate a RADIANCE description of a prism
SYNOPSIS
genprism mat name { - | vfile | N v1 v2 .. vN } [ -l lvect ][ -r radius ][ -c ][ -e ]
DESCRIPTION
Genprism produces a RADIANCE scene description of a prism, or extruded polygon. The polygon to extrude lies in the z==0 plane, and is
given as a list of (x,y) pairs on the standard input (-), or from the file vfile, or on the command line preceded by the number of ver-
tices, N. The order of the vertices and the extrusion vector lvect (default (0,0,1)) determine the surface orientations. The surfaces
that make up the prism will be modified by mat and their identifiers will begin with name. The -r option may be used to round the corners
of the object using spheres and cylinders. The -c option inhibits generation of a face connecting the last vertex to the first. The -e
option inhibits generation of the end polygons.
EXAMPLE
To produce a equilateral triangular prism:
genprism clear_plastic prism 3 0 0 .5 .866 1 0
AUTHOR
Greg Ward
BUGS
The rounding option only works for opaque prisms with outward facing normals. If the normals face inward, the appearance will be bizarre.
SEE ALSO
genrbox(1), genrev(1), gensurf(1), genworm(1), rpict(1), rvu(1), xform(1)
RADIANCE
3/19/96 GENPRISM(1)