Sponsored Content
Full Discussion: awk sum entire string
Top Forums Shell Programming and Scripting awk sum entire string Post 302771701 by nwalsh88 on Thursday 21st of February 2013 09:38:31 AM
Old 02-21-2013
head -3 totals.txt|od -bc output =
Quote:
0000000 060 060 060 060 060 060 060 062 067 063 060 060 012 060 060 060
0 0 0 0 0 0 0 2 7 3 0 0 \n 0 0 0
0000020 060 060 060 061 067 070 070 060 060 012
0 0 0 1 7 8 8 0 0 \n
0000032
---------- Post updated at 02:38 PM ---------- Previous update was at 02:18 PM ----------

Sorry Guys,

That awk command provided worked!

There was an error with my file.

Thanks for the help Guys

Last edited by nwalsh88; 02-21-2013 at 10:36 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sort entire line based on part of the string

hey gurus, my-build1-abc my-build10-abc my-build2-abc my-build22-abc my-build3-abc basically i want to numerically sort the entire lines based on the build number. I dont zero pad the numbers because thats "how it is" ;-) sort -n won't work because it starts from the beginning. ... (10 Replies)
Discussion started by: gurpal2000
10 Replies

2. UNIX for Dummies Questions & Answers

Search for a string and copy the entire line

Hello All, I am after the script or the command which can scan the entire file for a string $PART_ID and when found to extract/copy the corresponding $PART_ID value (e.g THIRE_PTY_SOFTWARE for the 1st occurance of $PART_ID in the attached file) to a file. Appreciate your help. Thanks in... (3 Replies)
Discussion started by: forumthreads
3 Replies

3. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

4. Web Development

Replacing a string in an entire mysql Database

Hi, Can someone please tell me how I can replace every occurrence of a string with another string, in the entire mysql database? What this means is, i just dont want to operate table by table. I want to search the database and automatically replace the string /opt/cacti/scripts/ with... (1 Reply)
Discussion started by: SkySmart
1 Replies

5. Shell Programming and Scripting

Print only matched string instead of entire line

Hi, I have a file whose lines are something like Tchampionspsq^@~^@^^^A^@^@^@^A^A^Aÿð^@^@^@^@^@^@^@^@^@^@^A^@^@^@^@^?ð^@^@^@^@^@^@^@?ð^@^@^@^@^@^@pppsq^@~^@#@^@^@^@^@^@^Hw^H^@^@^@^K^@^@^@^@xp^At^@^FTtime2psq^@ ~^@^^^A^@^@^@^B^A I need to extract all words matching T*psq from the file. Thing is... (4 Replies)
Discussion started by: shekhar2010us
4 Replies

6. Shell Programming and Scripting

Print entire line only if certain fixed character matches the string

Hi All, I have a file testarun.txt contains the below lines and i want to print the lines if the character positions 7-8 matches 01. 201401011111 201401022222 201402013333 201402024444 201403015555 201403026666 201404017777 201404028888 201405019999 201405020000 I am trying the... (4 Replies)
Discussion started by: Arunprasad
4 Replies

7. Shell Programming and Scripting

Regular Expression - Switch Entire String

I would like to be able to use a regular expression to find and replace entire strings, but not replace if the string is a substring in a larger string. Example: $string = "ABC ABCDEF ABC ABCDEF ABC"; Something like - $string =~ s/ABC/XYZ/g; ->Desired: $string = "XYZ ABCDEF XYZ ABCDEF... (3 Replies)
Discussion started by: rjulich
3 Replies

8. Shell Programming and Scripting

Avoid printing entire line if string not found

so im searching the process table with: ps -ef | awk -F"./rello.java" '{ print substr($0, index($0,$2)) }' I only want it to print everything that's infront of the "./rello.java". That's because im basically getting the arguments that was passed to the rello.java script. this works. ... (2 Replies)
Discussion started by: SkySmart
2 Replies

9. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies

10. UNIX for Beginners Questions & Answers

Awk: count unique elements in a field and sum their occurence across the entire file

Hi, Sure it's an easy one, but it drives me insane. input ("|" separated): 1|A,B,C,A 2|A,D,D 3|A,B,B I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1. I am trying to get this output... (5 Replies)
Discussion started by: beca123456
5 Replies
Business::EDI::Spec(3pm)				User Contributed Perl Documentation				  Business::EDI::Spec(3pm)

NAME
Business::EDI::Spec - Object class for CSV-based U.N. EDI specifications SYNOPSIS
use Business::EDI::Spec; my $spec = Business::EDI::Spec->new('segment'); DESCRIPTION
CSV files originally from edi4r are included as part of Business::EDI. They are used to define the many different messages, segements, data elements, composite data elements, and codelists that are part of a given version of the U.N. specification. The CSV spec files are composed differently for the different structures defined. So we have to parse them differently. ==> Business/EDI/data/edifact/untdid/EDCD.d07a.csv # Composite Elements CompositeCode;label;pos;code;mandatory;def;[pos;code;mandatory;def;...] C001;TRANSPORT MEANS;010;8179;C;an..8;020;1131;C;an..17;030;3055;C;an..3;040;8178;C;an..17; C002;DOCUMENT/MESSAGE NAME;010;1001;C;an..3;020;1131;C;an..17;030;3055;C;an..3;040;1000;C;an..35; C004;EVENT CATEGORY;010;9637;C;an..3;020;1131;C;an..17;030;3055;C;an..3;040;9636;C;an..70; C001 => {label => 'TRANSPORT MEANS;010;8179;C;an..8;020;1131;C;an..17;030;3055;C;an..3;040;8178;C;an..17; ==> Business/EDI/data/edifact/untdid/EDED.d07a.csv # Data Elements code;def;class(?):label 1000;an..35;B;Document name 1001;an..3;C;Document name code 1003;an..6;B;Message type code 1000 => {label => 'an..35;B;Document name ==> Business/EDI/data/edifact/untdid/EDMD.d07a.csv # Messages MessageCode:x:rel:org:z:SegmentGroup;label;SegCode;mandatory;repeats;[SegCode;mandatory;repeats;...] APERAK:D:07A:UN::;Application error and acknowledgement message;UNH;M;1;BGM;M;1;DTM;C;9;FTX;C;9;CNT;C;9;SG1;C;99;SG2;C;9;SG3;C;9;SG4;C;99999;UNT;M;1 APERAK:D:07A:UN::SG1;SG01;DOC;M;1;DTM;C;99 APERAK:D:07A:UN::SG2;SG02;RFF;M;1;DTM;C;9 APERAK:D:07A:UN:: => {label => 'Application error and acknowledgement message', UNH;M;1; BGM;M;1; DTM;C;9;FTX;C;9;CNT;C;9;SG1;C;99;SG2;C;9;SG3;C;9;SG4;C;99999;UNT;M;1 ==> Business/EDI/data/edifact/untdid/EDSD.d07a.csv # Segments SegCode;label;pos;code;class;repeats[pos;code;class;repeats;...] ADR;ADDRESS;010;C817;C;1;020;C090;C;1;030;3164;C;1;040;3251;C;1;050;3207;C;1;060;C819;C;5;070;C517;C;5; AGR;AGREEMENT IDENTIFICATION;010;C543;C;1;020;9419;C;1; AJT;ADJUSTMENT DETAILS;010;4465;M;1;020;1082;C;1; ADR => {label => 'ADDRESS', 010;C817;C;1;020;C090;C;1;030;3164;C;1;040;3251;C;1;050;3207;C;1;060;C819;C;5;070;C517;C;5; ==> Business/EDI/data/edifact/untdid/IDCD.d07a.csv # Composites (interactive) E001 => {label => 'ADDRESS DETAILS;010;3477;M;an..3;020;3286;M;an..70;030;3286;C;an..70;040;3286;C;an..70;050;3286;C;an..70;060;3286;C;an..70;070;3286;C;an..70; ==> Business/EDI/data/edifact/untdid/IDMD.d07a.csv # Messages (interactive) MsgCode:x:rel:org:z:SegmentGroup;label;SegCode;mandatory;class;repeats;;[mandatory;class;repeats;...] IHCEBI:D:07A:UN::;Interactive health insurance eligibility and benefits inquiry and;UIH;M;1;MSD;M;1;SG1;C;9;SG2;C;1;UIT;M;1 IHCEBI:D:07A:UN::SG1;SG01;PRT;M;1;NAA;C;9;CON;C;9;FRM;C;9 IHCEBI:D:07A:UN::SG2;SG02;DTI;M;1;ICI;C;1;FRM;C;9;SG3;C;999 IHCEBI:D:07A:UN::SG3;SG03;BCD;M;1;HDS;C;9;DTI;C;1;PRT;C;9;FRM;C;9 IHCLME:D:07A:UN::;Health care claim or encounter request and response - interactive;UIH;M;1;MSD;C;1;PRT;C;9;NAA;C;9;CON;C;9;BLI;C;1;ITC;C;1;FRM;C;99;SG1;C;3;SG2;C;99;UIT;M;1 IHCLME:D:07A:UN::SG1;SG01;OTI;M;1;NAA;C;2 IHCLME:D:07A:UN::SG2;SG02;PSI;M;1;DNT;C;35 ==> Business/EDI/data/edifact/untdid/IDSD.d07a.csv # Segments (interactive) SegCode;label;pos;code;mandatory;repeats(?) AAI;ACCOMMODATION ALLOCATION INFORMATION;010;E997;M;20; ADS;ADDRESS;010;E817;C;1;020;E001;C;1;030;3164;C;1;040;3251;C;1;050;3207;C;1;060;E819;C;1;070;E517;C;1; AAI => {label => 'ACCOMMODATION ALLOCATION INFORMATION', pos => '010', E997;M;20; TO DO
Parsing for interactive specs. SEE ALSO
edi4r - http://edi4r.rubyforge.org Business::EDI AUTHOR
Joe Atzberger perl v5.12.4 2010-09-08 Business::EDI::Spec(3pm)
All times are GMT -4. The time now is 03:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy