Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Create file with column values Post 302321785 by naveen.kuppili on Tuesday 2nd of June 2009 06:06:22 AM
Old 06-02-2009
Code:
#! /bin/ksh
i="1"
while read line
do
x=`awk -v num="$i" '{if(NR==num) print($2);}' mvm.txt`
y=`awk -v num="$i" '{if(NR==num) print($3);}' mvm.txt`
case $x in +([0-9])*(.)*([0-9]) )
        touch mvm_file_"$x"_"$y".txt
        ;;
        * )
        ;;
esac
i=`expr $i + 1`
done < mvm.txt

Yes i worked on it and is solved.

Last edited by Don Cragun; 06-06-2016 at 01:19 AM.. Reason: Add CODE tags.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check Null values in a file column by column if columns are Not NULLs

Hi All, I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
Discussion started by: Mandab
7 Replies

2. Shell Programming and Scripting

print unique values of a column and sum up the corresponding values in next column

Hi All, I have a file which is having 3 columns as (string string integer) a b 1 x y 2 p k 5 y y 4 ..... ..... Question: I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
Discussion started by: amigarus
6 Replies

3. UNIX for Dummies Questions & Answers

Replace values in a specified column of a file

Hello, I have a file with four columns and I would like to replace values in the second column only. An arbitrary example is: 100 A 105 B 200 B 205 C 300 C 305 D 400 D 405 E 500 E 505 F I need to replace the second column as shown below: ... (4 Replies)
Discussion started by: Gussifinknottle
4 Replies

4. Shell Programming and Scripting

Checking the Column values in a file.

Hi All, I have a file that has ~2.9Millions lines with 32 columns respectively. The columns numbers 23,27 are the primary Keys for the file. The fields are delimited by TAB. I need to check the condition If Column number: 20 is NOT NULL Column number: 21 is not 0 Column number: 22 is... (7 Replies)
Discussion started by: filter
7 Replies

5. UNIX for Dummies Questions & Answers

shift values in one column as header for values in another column

Hi Gurus, I have a tab separated text file with two columns. I would like to make the first column values as headings for the second column values. Ex. >value1 subjects >value2 priorities >value3 requirements ...etc and I want to have a file >value1 subjects >value2 priorities... (4 Replies)
Discussion started by: Unilearn
4 Replies

6. UNIX for Dummies Questions & Answers

Create a file with input values required

Hi Guys Please can you help me to create a file using the following inputs 2351 first input 2339 second input all this rows need to have the value 0 in front 2338 third input 2333 fourth input all this rows need to have the value 1 in front count all the rows in the file and insert the... (10 Replies)
Discussion started by: jiam912
10 Replies

7. Shell Programming and Scripting

Create file with name first column name.

Hi please help me in resolving the scenario. Source File: col1 col3 ----- ----- file1 data1 file2 data2 file1 data3 file3 data4 file5 data5 .. ... .... and so on. Result should be:4 files created. first file, file1.txt (no need to worry about .txt extension) will... (1 Reply)
Discussion started by: maks475
1 Replies

8. Shell Programming and Scripting

Remove the values from a certain column without deleting the Column name in a .CSV file

(14 Replies)
Discussion started by: dhruuv369
14 Replies

9. Shell Programming and Scripting

Replace column values from other file

I have one file as it has the following format File1 S No Site IP Address 1 Australia 192.168.0.1/26 2 Australia 192.168.0.2/26 3 Australia 192.168.0.3/26 I need awk/sed command to replace the column2 value ( under Site) with some other... (8 Replies)
Discussion started by: samaritan
8 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 12:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy