Sponsored Content
Full Discussion: awk to find a formated o/p
Top Forums Shell Programming and Scripting awk to find a formated o/p Post 302248190 by radoulov on Friday 17th of October 2008 05:39:01 AM
Old 10-17-2008
Use nawk or /usr/xpg4/bin/awk on Solaris:

Code:
awk -F'\n' '$0="name: "$1OFS$3' RS= infile

Just noticed the last colon:

Code:
awk -F'\n' '{sub(/since /,":");print"name: "$1OFS$3}' RS= infile

 

10 More Discussions You Might Find Interesting

1. SuSE

Disk Formated with NTFS

HI All, My pc has two disks, One disk loaded with windows NT 2000 and redhat linux 7.2 dual boot. Another disk 80GB added and formated with NTFS file system. How to access the 80GB NTFS file system disk by booting linux os. Thanks in advance Bache Gowda (4 Replies)
Discussion started by: bache_gowda
4 Replies

2. Windows & DOS: Issues & Discussions

1.44mb disk formated = 1.38mb left??

I was formating a couple of floppy disks, to make room for a ftp install of suse. However, the files you are suposed to put on the floppys are 1.4 mb. I thought "Fine, I have a 1.44 mb disk here". But appearantly windows uses 600kb on....tmp files or something. If anyone knows how I might fix... (4 Replies)
Discussion started by: G-wizz
4 Replies

3. Shell Programming and Scripting

processing tab-formated output of command w/bash

I have a command that when ran it will have an output such as string LongerString string2 longerString2 More MoreStrings seperated by tabs. The command lists domains and their accounts set up in my server admin software (interworx). The end result will be that it will run rsync for... (2 Replies)
Discussion started by: sweede
2 Replies

4. Shell Programming and Scripting

Create a formated text file

Hi, I have written a BASH shell script (included below) which will allow me to monitor my blood pressure. The script computes the mean of 5 user input systolic, diastolic, and heart rate values. I would like the script to then append these three values to their respective columns in a text... (5 Replies)
Discussion started by: msb65
5 Replies

5. Shell Programming and Scripting

Find avg using awk

Hi, i need some help plz... The file data.txt contains: code of student,surname and name,code of lesson,grade of lesson.The number of lessons of each student is not the same. 25,Jackson Steve,12,4,34,2,65,2 29,Jordan Mary,13,6,23,8,56,4,34,2 04,Leven Kate,14,6,15,6,26,4 34,Owen... (10 Replies)
Discussion started by: Steve_09
10 Replies

6. Shell Programming and Scripting

Awk find and sel

Hi to all! I need to make an script to find when an user changes the IP. The log file have this simple structure; example.txt Jack 192.168.1.2 Tom 192.168.12.225 Mary 192.168.1.22 Jack 192.168.1.5 Patrick 192.168.1.88If match the same user in the first column and have differents IP in... (3 Replies)
Discussion started by: LordXeno
3 Replies

7. Shell Programming and Scripting

Using awk to find sentences.

I am trying to print out sentences that meets a regular expression in awk (I’m open to using other tools, too). I got the regular expression I want to use, "(\+ \{4\})" from user ripat in a grep forum. Unfortunately with grep I couldn't print only the sentence. While searching for awk... (8 Replies)
Discussion started by: danbroz
8 Replies

8. Filesystems, Disks and Memory

Recover a mistaken swap-formated USB-HD

Hi! Installing the debian wheezy by netinstall my external USB-HD (2TB) is erroneously completly formated as swap-filesystem. I was to lazy to disconnect the USB-HD, so now i could kick myself . Is there any chance to rescue the data. I tried to find a way by using gparted: the whole HD is... (3 Replies)
Discussion started by: IMPe
3 Replies

9. Shell Programming and Scripting

find percentage - awk

Please help me with this ... Input file /vol/test1 10G /vol/test2 1G /vol/test3 200G /vol/test4 3G Output File /vol/test1 10G - - 9G - /vol/test2 1024M - - 921M - /vol/test3 200G - - 180G - /vol/test4 3072M - - 2764M - Basically if Column 2 ( which is... (6 Replies)
Discussion started by: greycells
6 Replies

10. Shell Programming and Scripting

Find and replace in awk

I have a file that I am trying to find a specific word, then replace text within that string. file TestA2015 TestB2016 Example. Replace TestB2016 to TestB0000, so if TestB is found replace the original "2016" to "0000". Thank you :). awk tried awk '{ sub(/TestB$/, "0000", $6) }1'... (5 Replies)
Discussion started by: cmccabe
5 Replies
insq(9F)						   Kernel Functions for Drivers 						  insq(9F)

NAME
insq - insert a message into a queue SYNOPSIS
#include <sys/stream.h> int insq(queue_t *q, mblk_t *emp, mblk_t *nmp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
q Pointer to the queue containing message emp. emp Enqueued message before which the new message is to be inserted. mblk_t is an instance of the msgb(9S) structure. nmp Message to be inserted. DESCRIPTION
The insq() function inserts a message into a queue. The message to be inserted, nmp, is placed in q immediately before the message emp. If emp is NULL, the new message is placed at the end of the queue. The queue class of the new message is ignored. All flow control parameters are updated. The service procedure is enabled unless QNOENB is set. RETURN VALUES
The insq() function returns 1 on success, and 0 on failure. CONTEXT
The insq() function can be called from user, interrupt, or kernel context. EXAMPLES
This routine illustrates the steps a transport provider may take to place expedited data ahead of normal data on a queue (assume all M_DATA messages are converted into M_PROTO T_DATA_REQ messages). Normal T_DATA_REQ messages are just placed on the end of the queue (line 16). However, expedited T_EXDATA_REQ messages are inserted before any normal messages already on the queue (line 25). If there are no normal messages on the queue, bp will be NULL and we fall out of the for loop (line 21). insq acts like putq(9F) in this case. 1 #include 2 #include 3 4 static int 5 xxxwput(queue_t *q, mblk_t *mp) 6 { 7 union T_primitives *tp; 8 mblk_t *bp; 9 union T_primitives *ntp; 10 11 switch (mp->b_datap->db_type) { 12 case M_PROTO: 13 tp = (union T_primitives *)mp->b_rptr; 14 switch (tp->type) { 15 case T_DATA_REQ: 16 putq(q, mp); 17 break; 18 19 case T_EXDATA_REQ: 20 /* Insert code here to protect queue and message block */ 21 for (bp = q->q_first; bp; bp = bp->b_next) { 22 if (bp->b_datap->db_type == M_PROTO) { 23 ntp = (union T_primitives *)bp->b_rptr; 24 if (ntp->type != T_EXDATA_REQ) 25 break; 26 } 27 } 28 (void)insq(q, bp, mp); 29 /* End of region that must be protected */ 30 break; . . . 31 } 32 } 33 } When using insq(), you must ensure that the queue and the message block is not modified by another thread at the same time. You can achieve this either by using STREAMS functions or by implementing your own locking. SEE ALSO
putq(9F), rmvq(9F), msgb(9S) Writing Device Drivers STREAMS Programming Guide WARNINGS
If emp is non-NULL, it must point to a message on q or a system panic could result. SunOS 5.11 16 Jan 2006 insq(9F)
All times are GMT -4. The time now is 01:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy