Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Sum up a decimal column in a tab separated text file and error handling Post 302398330 by pssandeep on Wednesday 24th of February 2010 09:05:42 AM
Old 02-24-2010
Hi,

thanks its working. Its not working whn i am using complete path for "awk"

One other question how to do error handling on this command,

For example, if something fails while adding up or it does not able to add a column because of data problem or it goes to infinite loop.

Do you suggest any best practices and my script should fail if any thing happens

thanks,
Sandeep
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete first column in tab-delimited text-file

I have a large text-file with tab-delimited genetic data that looks like: KSC112 KSC234 0 0 1 1 A G C T I simply wan to delete the first column, but since the file has 600 000 columns, it is not possible with awk (seems to be limited at 32k columns). Does anyone have an idea how to do this? (2 Replies)
Discussion started by: andmal
2 Replies

2. Shell Programming and Scripting

parse file into tab separated columns

Hello, I am trying to parse a file that resembles the last three groupings into something looking like the first two lines. I've fiddled with sed and awk a bit, but can't get anything to work properly. I need them separated by some delimiter. The file is some 23,000 lines of the stuff.... ... (9 Replies)
Discussion started by: dkozel
9 Replies

3. Shell Programming and Scripting

Sum of decimal numbers in column

Hi!!! I have n decimal numbers in column: 1.23 3.45 5.16 . . . How to do arithmetic sum of theese numbers??? Thanks!!!:D (4 Replies)
Discussion started by: tdev457
4 Replies

4. UNIX for Dummies Questions & Answers

Add a new column to a tab delimited text file

I want to add a new column to a tab delimited text file. It will be the first column and it will just be 1's. How do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

5. UNIX for Dummies Questions & Answers

Using awk to log transform a column in a tab-delimited text file?

How do I use awk to log transform the fifth column of a tab-delimited text file? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

6. UNIX for Dummies Questions & Answers

tab-separated file to matrix conversion

hello all, i have an input file like that A A X0 A B X1 A C X2 ... A Z Xx B A X1 B B X3 .... Z A Xx Z B X4 and i want to have an output like that A B C D A X0 X1 X2 Xy B X1 X3 X4 (4 Replies)
Discussion started by: TheTransporter
4 Replies

7. Shell Programming and Scripting

Problem with a tab separated file

Hi, I have created a tab separated file from the following input file. ADDRESS1 CITY STATE POSTAL COUNTRY LON LAT 32 PRINZREGENTENSTRASSE ROSENHEIM BAYERN 83022 DEU 1212182 4785699 263 VIA DANTE ALIGHIERI BARI PUGLIA 70122 ITA 1686233 4112154 30 VIA MILANO ... (1 Reply)
Discussion started by: ramky79
1 Replies

8. Shell Programming and Scripting

How to replace & with and in tab separated file?

Hi, I have a tab separated. I want to replace all the "&" in 8th column of the file with "and" .I am trying with awk -F, -vOFS=\\t '{$8=($8=="&")?"and":$8}1' test> test1.txt My file is abc def ghk hjk lkm hgb jkluy acvf & bhj hihuhu fgg me mine he her go went has has & had hgf hgy ... (1 Reply)
Discussion started by: jagdishrout
1 Replies

9. Shell Programming and Scripting

Read a tab separated file with empty column

Hi all, I'm trying to read a tab separated file and apply some functions on each column. I have an issue with empty column. Exemple: $ #cat with the sed to allow you to see my tab $ cat foo.txt| sed 's/\t/;/g' a;1;x b;;yI wanted to something like that: while read col1 col2 col3 do ... (4 Replies)
Discussion started by: maturix
4 Replies

10. Shell Programming and Scripting

Convert tab separated text to non-trivial xml. (pwsafe --> KeePassx)

I'd like to take the output of `pwsafe --exportdb > database.txt` and convert it to a KeePassX XML friendly format (feature request in pwsafe). I found flat file converter but the syntax is beyond me with this example. Solutions are welcomed. More details Here is the pwsafe --> KeePassX XML... (2 Replies)
Discussion started by: graysky
2 Replies
getwd(3C)																 getwd(3C)

NAME
getwd() - get pathname of current working directory SYNOPSIS
DESCRIPTION
places the absolute pathname of the current working directory in the array pointed to by buf, and returns buf. If the length of the pathname of the current working directory is greater than bytes, fails and returns a null pointer. RETURN VALUE
Upon successful completion, returns a pointer to the current directory pathname. Otherwise, it returns NULL with set. ERRORS
fails if the following condition is encountered: The length of the specified path name exceeds bytes, or the length of a component of the path name exceeds bytes while is in effect. may fail if any of the following conditions are encountered: Read or search permission is denied for a component of pathname. buf points outside the allocated address space of the process. may not always detect this error. EXAMPLES
#include <stdio.h> #include <unistd.h> char *cwd; char buf[PATH_MAX+1]; ... if ((cwd = getwd(buf)) == NULL) { perror("getwd"); exit(1); } puts(cwd); WARNINGS
For portability, is preferred over this function. AUTHOR
was developed by HP and the University of California, Berkeley. SEE ALSO
getcwd(3C), thread_safety(5). STANDARDS CONFORMANCE
getwd(3C)
All times are GMT -4. The time now is 04:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy