10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
i'm new to awk, and i've been searching on the forum for sum of a column but all the scripts does sum a column of an entire file.
I've a file like this:
cat file.txt
1234 5678
5678 1234
I want to use awk to do sum of each column per line not entire file, compare the two then write the... (1 Reply)
Discussion started by: chofred
1 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I would like to be able to sum up the counts of a column by the ID of another column. Example (although the actual file I have has thousands of IDs):
Input file:
A1BG-AS1:001 3
A1BG-AS1:002 0
A1BG-AS1:003 2
A1CF:001 1038
A1CF:002 105
A1CF:003 115
A1CF:004 137
Desired output... (3 Replies)
Discussion started by: fadista
3 Replies
3. Shell Programming and Scripting
Hi All,
I have a requirement where I need to compare 2 files & if the values in the files match, it should proceed, else exit the script without proceeding further.
For e.g : Scenario 1
In this case, the script should exit without proceeding further.
Scenario 2
In this case, the script... (7 Replies)
Discussion started by: dsfreddie
7 Replies
4. Shell Programming and Scripting
- I have two files (File 1 and File 2) and the contents of the files are mentioned below.
- I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2.
- I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies
5. Shell Programming and Scripting
This is my file(Target.txt)
name|age|locaction
abc|23|del
xyz|24|mum
jkl|25|kol
The file should be like this
1|03252012
1|name|age|location
2|abc|23|del
2|xyz|24|mum
2|jkl|25|kol
2|kkk|26|hyd
3|4
Column 1 is row indicator
for row 1 and 2, column indicator is 1,for data rows... (1 Reply)
Discussion started by: itsranjan
1 Replies
6. Shell Programming and Scripting
Hi
I am writing a perl script which checks for the specific column values from a file and writes to the OUT file.
So the feed file has a header information and footer information.
I header information isaround107 lines i.e.
Starts with
START-OF-FILE
.......
so on ....
... (11 Replies)
Discussion started by: filter
11 Replies
7. Shell Programming and Scripting
I am running the following script :
cat ind_sls_extr_UX.out_sorted | while read each_rec
do
count=`echo "${each_rec}" | cut -c1-2`
if
then
final_amount=0
amount=`echo "${each_rec}" | cut -c280-287`
echo "${amount}"
final_amount=`expr ${amount} + ${amount}`
... (7 Replies)
Discussion started by: mady135
7 Replies
8. UNIX for Dummies Questions & Answers
Hiiii Friends
I have 2 files with huge data. I want to compare this 2 files & if they hav same set of vales in specific rows & columns i need to get that value from one file & replace it in other.
For example: I have few set data of both files here:
a.dat:
PDE-W 2009 12 16 5 29 11.11 ... (10 Replies)
Discussion started by: reva
10 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I have a file containing the following data:
junk123junk723itemcode001qty01price10total10junkjunk
junk123junk723itemcode002qty02price10total20junkjunk
..
..
..
could be 5000+ lines
I have an algo and need a code to implement this:
1. Linecount = wc -l (should give 5000)
2. For i... (1 Reply)
Discussion started by: shiroh_1982
1 Replies
10. Shell Programming and Scripting
Hi Gurus,
My requirement is, I am passing a file1.dat into this(rowcnt.sh) script,but returning a wrong value of -2.(it should be 4).Becoz my file1.dat contains 6records incl: Header & Footer.(6-2=4)
wrong output:
-------
#sh rowcnt.sh file1.dat
-2 actual_cnt except HDR & FTR
should be:... (3 Replies)
Discussion started by: vsubbu1000
3 Replies
sum(1B) SunOS/BSD Compatibility Package Commands sum(1B)
NAME
sum - calculate a checksum for a file
SYNOPSIS
/usr/ucb/sum file...
DESCRIPTION
sum calculates and displays a 16-bit checksum for the named file and displays the size of the file in kilobytes. It is typically used to
look for bad spots, or to validate a file communicated over some transmission line. The checksum is calculated by an algorithm which may
yield different results on machines with 16-bit ints and machines with 32-bit ints, so it cannot always be used to validate that a file has
been transferred between machines with different-sized ints.
USAGE
See largefile(5) for the description of the behavior of sum when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWscpu |
+-----------------------------+-----------------------------+
SEE ALSO
sum(1), wc(1), attributes(5), largefile(5)
DIAGNOSTICS
Read error is indistinguishable from EOF on most devices; check the block count.
NOTES
sum and /usr/bin/sum (see sum(1)) return different checksums.
This utility is obsolete.
SunOS 5.11 8 Nov 1995 sum(1B)