08-24-2008
Add comma to integer using AWK
Srr for being pain her
let say i have a data in a file like this
1@1000
2@2000
4@4000
5@7770
6@8998
7@80008
i am a newbie in Unix
i need to add a comma to integer using AWK function. for example, 1,000 or 80,008
how can i do that
ps. i'm using bash shell
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
how do you print the lines that contain integers only, using grep or awk?
thanks ,
apalex
------------------
this file below:
qwerty
01234
asdfgh
01234
qwer12
asdf05
will be:
01234
01234
qwer12
asdf05 (5 Replies)
Discussion started by: apalex
5 Replies
2. Shell Programming and Scripting
I am trying to create a script that will read from a file two non-integer values (decimals) and add those values together. For example, I want to add 1.51 and -2.37 together and get the sum. Any ideas? Thanks! (2 Replies)
Discussion started by: limshady411
2 Replies
3. Shell Programming and Scripting
I need to extract a value from a text file into a ksh script, and change the last two letters to "00". awk gets the right value (2500 in this example), but the variable has no value.
I use the following command:
StartTime=expr nawk 'NR==20 {print $11;exit}' $New_FILE
echo 1 $StartTime... (4 Replies)
Discussion started by: Iliklev
4 Replies
4. Shell Programming and Scripting
i got a file called Marks
The format of Marks is:
12345678 5 7
23456789 7 9 3
What can i do with a loop, read expr and echo command to produce a new file like below:
12345678:12
23456789:20
and also when we adding fewer than 3 value with expr, we need to change any null value for... (13 Replies)
Discussion started by: mingming88
13 Replies
5. Shell Programming and Scripting
Hi, I am having the following number in the file tmp
31013.004
20675.336
43318.190
30512.926
48992.559
277893.111
41831.330
8749.113
415980.576
28273.054
I want to add these numbers, I am using following script
awk 'END{print s}{s += $1}' tmp
its giving answer 947239 which is correct,... (3 Replies)
Discussion started by: chaitubek
3 Replies
6. UNIX Desktop Questions & Answers
hey, i have a list of devices that looks like so:
VolumeTask(DeviceName(DeviceName(DeviceNameInfo(MultiPathType_UID(Option<GUDeviceID>(GUDeviceID(ulonglong(358271365120608989UL))),Option<ulong>())))),2098560),... (5 Replies)
Discussion started by: boaz733
5 Replies
7. Shell Programming and Scripting
I would like to extract a number from $0 and calculate if it can be devided by 25. Though the number can also be less then 25 or bigger than 100. How do i extract the number and how can the integer be calculated?
String:
"all_results">39</span>I am looking for the number between "all_results"> ... (5 Replies)
Discussion started by: sdf
5 Replies
8. UNIX for Dummies Questions & Answers
---------- Post updated at 01:58 PM ---------- Previous update was at 01:48 PM ----------
For some reason my question is not getting printed. Here are the details:
Greetings.
I would like to add/subtact an integer to/from two columns of integers. I feel like this should be easy using awk... (3 Replies)
Discussion started by: Twinklefingers
3 Replies
9. Shell Programming and Scripting
Hi,
0.23 2.94% 0.00 0.00% 17.8G 55.7% 19.6G 40.9% 630 0.00%
0.06 0.77% - - 7524M 22.9% 15.6G 32.6% - -
From the above sample output. I need to compare whether the 6th field is more than 10G..if so print the entire line. Here the 6th field is memory
TIA (5 Replies)
Discussion started by: Sumanthsv
5 Replies
10. Shell Programming and Scripting
Hi Experts,
Please support
I have below data in file in comma seperated, but 4th column is containing comma in between numbers, bcz of which when i tried to parse the file the column 6th value(5049641141) is being removed from the file and value(222.82) in column 5 becoming value of column6.
... (3 Replies)
Discussion started by: as7951
3 Replies
LEARN ABOUT SUSE
tzselect
TZSELECT(8) Linux System Administration TZSELECT(8)
NAME
tzselect - select a timezone
SYNOPSIS
tzselect
DESCRIPTION
The tzselect program asks the user for information about the current location, and outputs the resulting timezone description to standard
output. The output is suitable as a value for the TZ environment variable.
All interaction with the user is done via standard input and standard error.
EXIT STATUS
The exit status is zero if a timezone was successfully obtained from the user, nonzero otherwise.
ENVIRONMENT
AWK Name of a Posix-compliant awk program (default: awk).
TZDIR Name of the directory containing timezone data files (default: /usr/share/zoneinfo).
FILES
TZDIR/iso3166.tab
Table of ISO 3166 2-letter country codes and country names.
TZDIR/zone.tab
Table of country codes, latitude and longitude, TZ values, and descriptive comments.
TZDIR/TZ
Time zone data file for timezone TZ.
SEE ALSO
tzfile(5), zdump(8), zic(8)
COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
2007-05-18 TZSELECT(8)