06-27-2011
I am trying to edit any one of the suggested codes so that I can do the following:
Leave columns 1 and 2 as they are.
For columns 3 -13 if the values are 1 then make it 0 (only if the whole column = 1, if it is 1 in columns that have other numbers treat it as any other number), if the value is other that 1 then subtract it by column 1.
I can't get it right
Any help would be highly appreciated...
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
i was doing a small program where if i was to be given the first 3 letters of any month i.e. in the form of Jan or Apr then it would return the column number where it finds a match. To do this i created a 12 element array of months with first 3 letters and if i echo'ed the contents of... (2 Replies)
Discussion started by: scriptingmani
2 Replies
2. UNIX for Dummies Questions & Answers
I have a data file that is arranged like this:
Marketing Ranjit Singh Eagles Dean Johnson FULL
Marketing Ken Whillans Eagles Karen Thompson FULL
Sales Peter RobertsonGolden TigersRich Gardener PART
President Sandeep Jain Wimps Ken Whillans CONT... (7 Replies)
Discussion started by: hitman247m
7 Replies
3. Shell Programming and Scripting
Does anyone know how to include as a script maybe an "echo" warning that explains that if a user uses the second number "zero" when dividing, that the result will BE "zero."
I need, example: 5/0 (second number) = 0, in script form.
current script:
echo "Enter a number"
read num1
echo... (4 Replies)
Discussion started by: jefferj54
4 Replies
4. Shell Programming and Scripting
Hi Guys,
I have a question on how i can get the column number in a file and used it in awk.
i have a file which it has these records inside it.
... (7 Replies)
Discussion started by: reignangel2003
7 Replies
5. Shell Programming and Scripting
Input file :
5 20
500 2
20 41
41 0
23 1
Desired output :
5
2
20
0
1
By comparing column 1 and 2 in each line, I hope can print out the column with smallest number.
I did try the following code, but it don't look good :( (2 Replies)
Discussion started by: perl_beginner
2 Replies
6. Shell Programming and Scripting
I currently have two programs written in C named "remove" and "calculate.
When I call ./remove it removes some data from stdin.
When I call ./calculate which takes in an argument and also data from stdin and calculates and returns a value.
Currently writing a script that calls both of these... (1 Reply)
Discussion started by: kadanakanz
1 Replies
7. Shell Programming and Scripting
please write a shell script
Table
--------------------------
1 2 3 a b c
3 4 5 c d e
7 8 9 f g h
Output should be like this
---------------
1 2 3
3 4 5
7 8 9
a b c
c d e
f g h (1 Reply)
Discussion started by: Priti2277
1 Replies
8. Shell Programming and Scripting
Split column data if the table has n number of column's with some record then how to split n number of colmn's line by line with records
Table
---------
Col1 col2 col3 col4 ....................col20
1 2 3 4 .................... 20
a b c d .................... v
... (11 Replies)
Discussion started by: Priti2277
11 Replies
9. Shell Programming and Scripting
Hello
I have something like this
a 1
b 1
c 1
d 1
e 1
This is inside 1.dat
and this is what I am trying to get
a 2
b 2
c 2
d 2
e 2 (4 Replies)
Discussion started by: jeo_fb
4 Replies
10. Shell Programming and Scripting
Hi!
I have a file as below:
0.000145 5.82056e-08
0.000146 6.82088e-08
0.000150 7.42115e-08
0.000156 8.52142e-08
0.000176 8.82169e-08
0.000178 9.82197e-08
I'd like to divide the values of the second column by its last entry (here 9.82197e-08).
I would be thankful if someone could... (6 Replies)
Discussion started by: Setareh12
6 Replies
LEARN ABOUT FREEBSD
colrm
COLRM(1) BSD General Commands Manual COLRM(1)
NAME
colrm -- remove columns from a file
SYNOPSIS
colrm [start [stop]]
DESCRIPTION
The colrm utility removes selected columns from the lines of a file. A column is defined as a single character in a line. Input is read
from the standard input. Output is written to the standard output.
If only the start column is specified, columns numbered less than the start column will be written. If both start and stop columns are spec-
ified, columns numbered less than the start column or greater than the stop column will be written. Column numbering starts with one, not
zero.
Tab characters increment the column count to the next multiple of eight. Backspace characters decrement the column count by one.
ENVIRONMENT
The LANG, LC_ALL and LC_CTYPE environment variables affect the execution of colrm as described in environ(7).
EXIT STATUS
The colrm utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
awk(1), column(1), cut(1), paste(1)
HISTORY
The colrm command appeared in 3.0BSD.
BSD
August 4, 2004 BSD