Sponsored Content
Full Discussion: Help please awk or cut
Top Forums UNIX for Dummies Questions & Answers Help please awk or cut Post 302161401 by jaduks on Thursday 24th of January 2008 11:31:19 AM
Old 01-24-2008
A quick solution would be this, but I fell awk would have been better

Code:
$ cat thefile.out
ID1,23-12-1983,32,12,
ID2,12-12-1982,,21,
ID3,14-06-2007,12,,
$ sed -e 's/,,/,/' -e 's/,$//' thefile.out > thefile.tmp
$ cat thefile.tmp
ID1,23-12-1983,32,12
ID2,12-12-1982,21
ID3,14-06-2007,12

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cut vs. sed vs. awk ?

hi again...need new help guys:p the file contains following infos... users/abc/bla1.exe newusers/defgh/ik/albg2.exe users2/opww/ertz/qqwertzu/rwerwew.exe how to get the file content into... users/abc/ newusers/defgh/ik/ users2/opww/ertz/qqwertzu/ with... you can erase the... (5 Replies)
Discussion started by: svennie
5 Replies

2. Shell Programming and Scripting

[grep awk cut] > awk

Hi, I'm very new to scripting. grep $s $filename | awk '{print $2}' | cut -c 1-8 How can I optimize this using a single awk? I tried: awk '/$s/ {print $2}' $filename | cut -c 1-8 However didn't work, I think the awk is not recognizing $s and the verbal is something else. (6 Replies)
Discussion started by: firdousamir
6 Replies

3. Shell Programming and Scripting

awk or cut

select some fields from data file (source.csv) The data in file(source.csv) is like "x1,2",,"y",,"z" How to get the 1st, 2nd and 3rd field from the file. Using awk or cut? Note: "x1,2" is one field. thanks, (16 Replies)
Discussion started by: anypager
16 Replies

4. Shell Programming and Scripting

Is awk vs cut which one is better

i was trying to work on program to look for users never log on sever.. using awk with awk is working last| awk '{print $1}' |sort -u > /tmp/users1$$ cat /etc/passwd | awk -F: '{print $1}' |sort -u > /tmp/users2$$ comm -13 /tmp/users$$ rm -f /tmp/users$$ with cut it is not working ... (3 Replies)
Discussion started by: macrules
3 Replies

5. Shell Programming and Scripting

HELP! using cut/awk

how would i write a shell script to show the number of lines in which int variable appears in a c++ program. how would i do this using cut or awk methods is it possbile and having a output similar to this x, number of apperances = y, number of apperances = (2 Replies)
Discussion started by: deadleg
2 Replies

6. Shell Programming and Scripting

Want to use awk instead of cut

I want to use awk instead of cut command. Following is my code: line="slNumber=US78AJF11643, slName=USJFKAAUSYDAAUL80441032900095, dummy sl found? sqlca.sqlcode=0" sl_WORD=`echo $line| cut -f 1 -d','` sl=`echo $sl_WORD | cut -f 2 -d'='` echo "$sl" Please suggest me about the code. ... (5 Replies)
Discussion started by: rinku
5 Replies

7. Shell Programming and Scripting

Using grep and cut within awk

Hi My input file looks like as follows: say a.txt "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss... (5 Replies)
Discussion started by: bittoo
5 Replies

8. Shell Programming and Scripting

Cut or awk in reverse

I may be making this too hard on myself, but I'm trying to find a way that I can use a cut or awk string to always remove the last two delimited fields of a string. Say I have PackageName-U939393-8.2.3.4.s390x.rpm But the s390x could be any string w/o periods in it, x8664 for example,... (9 Replies)
Discussion started by: cbo0485
9 Replies

9. UNIX for Dummies Questions & Answers

Regarding cut or awk command

Hi, I need a help with cut/awk command. I need to get certain values from a string provided. For example: i have a config file with below mentioned details oracle="user=name"/"pass/word"@databasename. I have used a command var1=`grep -w oracle sample.cfg | cut -d"=" -f2 | cut -d"/" -f1`. ... (10 Replies)
Discussion started by: kumars2102
10 Replies
QwtScaleArithmetic(3)						 Qwt User's Guide					     QwtScaleArithmetic(3)

NAME
QwtScaleArithmetic - Arithmetic including a tolerance. SYNOPSIS
#include <qwt_scale_engine.h> Static Public Member Functions static double ceil125 (double x) static double ceilEps (double value, double intervalSize) static int compareEps (double value1, double value2, double intervalSize) static double divideEps (double interval, double steps) static double floor125 (double x) static double floorEps (double value, double intervalSize) Detailed Description Arithmetic including a tolerance. Member Function Documentation double QwtScaleArithmetic::ceil125 (doublex) [static] Find the smallest value out of {1,2,5}*10^n with an integer number n which is greater than or equal to x Parameters: x Input value double QwtScaleArithmetic::ceilEps (doublevalue, doubleintervalSize) [static] Ceil a value, relative to an interval Parameters: value Value to ceil intervalSize Interval size See also: floorEps() int QwtScaleArithmetic::compareEps (doublevalue1, doublevalue2, doubleintervalSize) [static] Compare 2 values, relative to an interval. Values are 'equal', when : $ Parameters: value1 First value to compare value2 Second value to compare intervalSize interval size Returns: 0: if equal, -1: if value2 > value1, 1: if value1 > value2 double QwtScaleArithmetic::divideEps (doubleintervalSize, doublenumSteps) [static] Divide an interval into steps. $stepSize = (intervalSize - intervalSize * 10e^{-6}) / numSteps$.PP Parameters: intervalSize Interval size numSteps Number of steps Returns: Step size double QwtScaleArithmetic::floor125 (doublex) [static] Find the largest value out of {1,2,5}*10^n with an integer number n which is smaller than or equal to x. Parameters: x Input value double QwtScaleArithmetic::floorEps (doublevalue, doubleintervalSize) [static] Floor a value, relative to an interval Parameters: value Value to floor intervalSize Interval size See also: floorEps() Author Generated automatically by Doxygen for Qwt User's Guide from the source code. Version 5.2.2 Mon Aug 1 2011 QwtScaleArithmetic(3)
All times are GMT -4. The time now is 04:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy