Sponsored Content
Top Forums Shell Programming and Scripting awk if condition match and fix print decimal place Post 302938791 by horsepower on Thursday 19th of March 2015 02:56:57 AM
Old 03-19-2015
Thks guys, all the example above is working fantastically !
At the end i insert this "CONVFMT="%7.2f"" into the command, and it works perfectly Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

add numbers with decimal place in UNIX

i am trying to add numbers with decimal place and I am prompted with an error. this expr command works :add=`expr 1 + 1` :echo $add :2 but when i am trying to add :addThis=`expr 1.1 + 1` :expr: An integer value was expected. is there a way to add numbers with decimal place in UNIX? (4 Replies)
Discussion started by: tads98
4 Replies

2. Shell Programming and Scripting

awk to print lines based on string match on another line and condition

Hi folks, I have a text file that I need to parse, and I cant figure it out. The source is a report breaking down softwares from various companies with some basic info about them (see source snippet below). Ultimately what I want is an excel sheet with only Adobe and Microsoft software name and... (5 Replies)
Discussion started by: rowie718
5 Replies

3. Shell Programming and Scripting

awk if condition match and print all

Hi, I am trying to do something like this ... I use awk to match a pattern, and then print out all col. My code is : awk '{if ($1 ==300) print $1,$2-'$sbin7',$3}' tmp.txt output= 300 2 whereby sbin7=2, The thing is, I want to print all col and row, not just the matched line/row only, but... (10 Replies)
Discussion started by: horsepower
10 Replies

4. Shell Programming and Scripting

Unable to get the Specific column with 2 decimal place

Hi, I have an issue converting decimal places of a particular column, i am using below script to get the output, but the output is not generating in desired format. awk -F"," 'BEGIN{OFS=","}{if(NR==0)getline;if ($7 != "") {if ($7 > 0) $7=$7/100 ; {printf "%.2f"... (3 Replies)
Discussion started by: rramkrishnas
3 Replies

5. Shell Programming and Scripting

Print hex Ip address in decimal format inside awk script

Hi to all, May someone help me with the following. The awk script below is part of a bigger awk script, and this part attempts to print an Ip address that is in hex format in decimal format. I'm trying with following code but I'm getting 0.0.0.0 and the correct answer is 192.168.140.100 ... (9 Replies)
Discussion started by: Ophiuchus
9 Replies

6. UNIX for Dummies Questions & Answers

How to set decimal place in awk?

Dear all, I have a data test.txt as below. X22.30799720_T cg03868770 -0.5645412582127 2.4084685750406e-175 X22.30781182_A cg03868770 -0.5620426397492 3.5818034129169e-172 X22.30780724_C cg03868770 -0.5616890165605 2.9765569717858e-168 what I want is: X22.30799720_T cg03868770... (3 Replies)
Discussion started by: forevertl
3 Replies

7. Shell Programming and Scripting

Using awk to place decimal points at proper position

Hi, I have one input file which is delimited by pipe. I want to put decimal points in this input file at particular position in particular column and also get the negative sign (if any) at start of that column. $ cat Input_file.txt 11|10102693|1|20151202|10263204|20151127|N|0001... (7 Replies)
Discussion started by: Prathmesh
7 Replies

8. UNIX for Dummies Questions & Answers

How to trim the decimal place for all the columns?

Dear all, I have a file call test.txt which has 2000 columns, 1000 rows. If I want to trim all the columns to 3 decimal places, how can I do it? I know how to use awk prinf to trim specic columns. But I don't know how to trim all the columns. Thank you. data sample: 0.976004565 9.34567845... (6 Replies)
Discussion started by: forevertl
6 Replies

9. Shell Programming and Scripting

awk to print match or non-match and select fields/patterns for non-matches

In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies

10. Shell Programming and Scripting

Zero padding a Number before and after a decimal place

Hi I was hoping someone could help me with a sed script I am trying to write? I am on a Mac running ElCapitan I have some text that I have converted from a pdf that I want to format into an xml file. In the file I have managed to delete all the text I do not need. The text I have left is... (8 Replies)
Discussion started by: Paul Walker
8 Replies
Vector(7rheolef)						    rheolef-6.1 						  Vector(7rheolef)

NAME
Vector - STL vector<T> with reference counting DESCRIPTION
The class implement a reference counting wrapper for the STL vector<T> container class, with shallow copies. See also: @quotation The Standard Template Library, by Alexander Stephanov and Meng Lee. @end quotation This class provides the full vector<T> interface specification an could be used instead of vector<T>. NOTE
The write accessors T& operator[](size_type) as in v[i] may checks the reference count for each access. For a loop, a better usage is: Vector<T>::iterator i = v.begin(); Vector<T>::iterator last = v.end(); while (i != last) { ...} and the reference count check step occurs only two time, when accessing via begin() and end(). Thus, in order to encourage users to do it, we declare private theses member functions. A synonym of operator[] is at. IMPLEMENTATION
template<class T> class Vector : private smart_pointer<vector_rep<T> > { public: // typedefs: typedef iterator; typedef const_iterator; typedef pointer; typedef reference; typedef const_reference; typedef size_type; typedef difference_type; typedef value_type; typedef reverse_iterator; typedef const_reverse_iterator; // allocation/deallocation: explicit Vector (size_type n = 0, const T& value = T ()); Vector (const_iterator first, const_iterator last); void reserve (size_type n); void swap (Vector<T>& x) ; // accessors: iterator begin (); const_iterator begin () const; iterator end (); const_iterator end () const; reverse_iterator rbegin(); const_reverse_iterator rbegin() const; reverse_iterator rend(); const_reverse_iterator rend() const; size_type size () const; size_type max_size () const; size_type capacity () const; bool empty () const; void resize (size_type sz, T v = T ()); // non-standard ? private: const_reference operator[] (size_type n) const; reference operator[] (size_type n); public: const_reference at (size_type n) const; // non-standard ? reference at (size_type n); reference front (); const_reference front () const; reference back (); const_reference back () const; // insert/erase: void push_back (const T& x); iterator insert (iterator position, const T& x = T ()); void insert (iterator position, size_type n, const T& x); void insert (iterator position, const_iterator first, const_iterator last); void pop_back (); void erase (iterator position); void erase (iterator first, iterator last); }; rheolef-6.1 rheolef-6.1 Vector(7rheolef)
All times are GMT -4. The time now is 09:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy