Sponsored Content
Top Forums Shell Programming and Scripting awk to get multiple strings in one variable Post 303011862 by rdrtx1 on Wednesday 24th of January 2018 02:25:19 PM
Old 01-24-2018
Code:
awk 'BEGIN {
   printf ("%-40s %-5s %-15s\n", "File Names","Lines", "CHARS")
   printf ("%-40s %-5s %-15s\n", "--------------","-----","------")
}

$NF ~ /\(File\)/ {
   CSG=CSG $(NF-1) ","
}

$0 ~ /Lines/ {
   gsub("[^0-9]", "")
   LNN=$1
}

$1 ~ /^[0-9A-Fa-f]+$/ && length($1)==5 {
   if (! c[$NF]) CHR=CHR $NF ","
   c[$NF]=$NF
}

END {
   sub(",*$", "", CSG)
   sub(",*$", "", CHR)
   printf ("%-40s %-5s %-15s\n", CSG, LNN, CHR)
}' junk1.jnk

These 2 Users Gave Thanks to rdrtx1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk multiple variable array: comparison

Foo.txt 20 40 57 50 22 51 66 26 17 15 63 18 80 46 78 99 87 2 14 14 51 47 49 100 58 Bar.txt 20 22 51 15 63 78 99 55 51 58 How to get output using awk 20 22 57 50 51 15 26 17 63 78 80 46 99 55 - - 51 58 49 100 (5 Replies)
Discussion started by: genehunter
5 Replies

2. UNIX for Dummies Questions & Answers

best method of replacing multiple strings in multiple files - sed or awk? most simple preferred :)

Hi guys, say I have a few files in a directory (58 text files or somthing) each one contains mulitple strings that I wish to replace with other strings so in these 58 files I'm looking for say the following strings: JAM (replace with BUTTER) BREAD (replace with CRACKER) SCOOP (replace... (19 Replies)
Discussion started by: rich@ardz
19 Replies

3. Shell Programming and Scripting

CSV to SQL insert: Awk for strings with multiple lines in csv

Hi Fellows, I have been struggling to fix an issue in csv records to compose sql statements and have been really losing sleep over it. Here is the problem: I have csv files in the following pipe-delimited format: Column1|Column2|Column3|Column4|NEWLINE Address Type|some descriptive... (4 Replies)
Discussion started by: khayal
4 Replies

4. Shell Programming and Scripting

Sed or Awk for lines between two strings multiple times and keep the last one

Hi, I am trying to get lines between the last occurrences of two patterns. I have files that have several occurrences of “Standard” and “Visual”. I will like to get the lines between “Standard” and “Visual” but I only want to retain only the last one e.g. Standard Some words Some words Some... (4 Replies)
Discussion started by: damanidada
4 Replies

5. Shell Programming and Scripting

awk? extract quoted "" strings from multiple lines.

I am trying to extract multiple strings from snmp-mib files like below. ----- $ cat IF-MIB.mib <snip> linkDown NOTIFICATION-TYPE OBJECTS { ifIndex, ifAdminStatus, ifOperStatus } STATUS current DESCRIPTION "A linkDown trap signifies that the SNMP entity, acting in... (5 Replies)
Discussion started by: genzo
5 Replies

6. Shell Programming and Scripting

Print lines between two strings multiple occurencies (with sed, awk, or grep)

Hello, I can extract lines in a file, between two strings but only one time. If there are multiple occurencies, my command show only one block. Example, monfichier.txt contains : debut_sect texte L1 texte L2 texte L3 texte L4 fin_sect donnees inutiles 1 donnees inutiles 2 ... (8 Replies)
Discussion started by: theclem35
8 Replies

7. Shell Programming and Scripting

Passing multiple variable to awk

Hi , can I pass more then one variable to awk using -v option? (4 Replies)
Discussion started by: Anupam_Halder
4 Replies

8. Shell Programming and Scripting

awk extract strings matching multiple patterns

Hi, I wasn't quite sure how to title this one! Here goes: I have some already partially parsed log files, which I now need to extract info from. Because of the way they are originally and the fact they have been partially processed already, I can't make any assumptions on the number of... (8 Replies)
Discussion started by: chrissycc
8 Replies

9. Programming

awk to count occurrence of strings and loop for multiple columns

Hi all, If i would like to process a file input as below: col1 col2 col3 ...col100 1 A C E A ... 3 D E G A 5 T T A A 6 D C A G how can i perform a for loop to count the occurences of letters in each column? (just like uniq -c ) in every column. on top of that, i would also like... (8 Replies)
Discussion started by: iling14
8 Replies

10. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
XmPushButton(3) 						  LessTif Manuals						   XmPushButton(3)

NAME
XmPushButton - Motif-compatible pushbutton widget SYNOPSIS
#include <Xm/PushB.h> XmPushButton XmCreatePushButton DESCRIPTION
XmPushButton X RESOURCES
Name Class Type Default Access ------------------------------------------------------------------------------------------------------------ XmNmultiClick XmCMultiClick MultiClick NULL CSG XmNfillOnArm XmCFillOnArm Boolean NULL CSG XmNarmColor XmCArmColor Pixel NULL CSG XmNarmPixmap XmCArmPixmap PrimForegroundPixmap NULL CSG XmNshowAsDefault XmCShowAsDefault BooleanDimension NULL CSG XmNactivateCallback XmCCallback Callback NULL CSG XmNarmCallback XmCCallback Callback NULL CSG XmNdisarmCallback XmCCallback Callback NULL CSG XmNshadowThickness XmCShadowThickness HorizontalDimension NULL CSG XmNdefaultButtonShadowThickness XmCDefaultButtonShadowThickness HorizontalDimension NULL CSG XmNtraversalOn XmCTraversalOn Boolean NULL CSG XmNhighlightThickness XmCHighlightThickness HorizontalDimension NULL CSG XmNmultiClick XmNfillOnArm XmNarmColor XmNarmPixmap XmNshowAsDefault XmNactivateCallback XmNarmCallback XmNdisarmCallback XmNshadowThickness XmNdefaultButtonShadowThickness XmNtraversalOn XmNhighlightThickness CLASS HIERARCHY
Object(3) Rect(3) UnNamedObj(3) Core(3) XmPrimitive(3) XmLabel(3) XmPushButton(3) CALLBACKS
CONVENIENCE FUNCTIONS
SEE ALSO
LessTif Project April 1998 XmPushButton(3)
All times are GMT -4. The time now is 10:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy