Sponsored Content
Top Forums Shell Programming and Scripting Count Segmentation fault and write to the file Post 303023631 by Scott on Thursday 20th of September 2018 10:01:45 AM
Old 09-20-2018
In awk:
Code:
awk '/^root: nmp/ { getline; V[$0]++ } END { for( v in V ) print v " " V[v] }' 
Segmentation fault 1
10 2
3.1 1

This method doesn't guarantee the order. You'd need to modify it slightly to get that, and it's tied to the output exactly as you've presented it.

Why is there an "old" nmp? Perhaps it's seg faulting because some of the underlying libraries it needs have been replaced (because it's old)?
 

10 More Discussions You Might Find Interesting

1. Programming

segmentation fault

hi all i'm trying to execute a c program under linux RH and it gives me segmentation fault, this program was running under unix at&t anybody kow what the problem could be? thanx in advance regards (2 Replies)
Discussion started by: omran
2 Replies

2. Programming

segmentation fault

ive written my code in C for implementation of a simple lexical analyser using singly linked list hence am making use of dynamic allocation,but when run in linux it gives a segmentation fault is it cause of the malloc function that ive made use of????any suggestions as to what i could do??? thank... (8 Replies)
Discussion started by: rockgal
8 Replies

3. Programming

Why not a segmentation fault??

Hi, Why I don't receive a segmentation fault in the following sample. int main(void) { char buff; sprintf(buff,"Hello world"); printf("%s\n",buff); } If I define a buffer of 10 elements and I'm trying to put inside it twelve elements, Should I receive a sigsev... (22 Replies)
Discussion started by: lagigliaivan
22 Replies

4. Programming

Segmentation fault.

I'm getting a segmentation fault. I'm new to Linux programming. Thanks so much for all of your input.:eek: #include </usr/include/mysql++/mysql++.h> #include <stdio.h> #include <iostream> #include <sstream> #include <string.h> using namespace std; int outputToImport(const char*... (1 Reply)
Discussion started by: sepoto
1 Replies

5. UNIX for Advanced & Expert Users

segmentation fault with ps

What does this mean and why is this happening? $ ps -ef | grep ocular Segmentation fault (core dumped) $ ps -ef | grep ocular Segmentation fault (core dumped) $ ps aux | grep ocular Segmentation fault (core dumped) $ ps Segmentation fault (core dumped) $ pkill okular $ ps... (1 Reply)
Discussion started by: cokedude
1 Replies

6. Programming

Segmentation fault in fopen when in write mode.

Hi All, Although this code is quite long but it does not require one to understand the logic of the code. I am trying to run this code on my Linux machine using gcc. But when this line is executed: output_pointer = fopen ( file_name , "w" );I get segmentation fault. I've been breaking my head... (17 Replies)
Discussion started by: shoaibjameel123
17 Replies

7. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

8. Solaris

Segmentation fault

Hi Guys, I just installed and booted a zone called testzone. When I logged in remotely and tried changing to root user I get this error: "Segmentation fault" Can someone please help me resolve this? Thanks alot (2 Replies)
Discussion started by: cjashu
2 Replies

9. Fedora

Segmentation fault while trying to recover file with extundelete

hello, I accidentally removed a directory with its contents with rm -r and I don't have a backup. I got to know about extundelete utility on linux and downloaded on my Linux Fedora 28 notebook PC. The file system is ext4. I log in to the system as single user mode and unmount the /home directory... (2 Replies)
Discussion started by: milhan
2 Replies

10. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
rmvq(9F)						   Kernel Functions for Drivers 						  rmvq(9F)

NAME
rmvq - remove a message from a queue SYNOPSIS
#include <sys/stream.h> void rmvq(queue_t *q, mblk_t *mp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
q Queue containing the message to be removed. mp Message to remove. DESCRIPTION
rmvq() removes a message from a queue. A message can be removed from anywhere on a queue. To prevent modules and drivers from having to deal with the internals of message linkage on a queue, either rmvq() or getq(9F) should be used to remove a message from a queue. CONTEXT
rmvq() can be called from user or interrupt context. EXAMPLES
This code fragment illustrates how one may flush one type of message from a queue. In this case, only M_PROTO T_DATA_IND messages are flushed. For each message on the queue, if it is an M_PROTO message (line 8) of type T_DATA_IND (line 10), save a pointer to the next mes- sage (line 11), remove the T_DATA_IND message (line 12) and free it (line 13). Continue with the next message in the list (line 19). 1 mblk_t *mp, *nmp; 2 queue_t *q; 3 union T_primitives *tp; 4 5 /* Insert code here to protect queue and message block */ 6 mp = q->q_first; 7 while (mp) { 8 if (mp->b_datap->db_type == M_PROTO) { 9 tp = (union T_primitives *)mp->b_rptr; 10 if (tp->type == T_DATA_IND) { 11 nmp = mp->b_next; 12 rmvq(q, mp); 13 freemsg(mp); 14 mp = nmp; 15 } else { 16 mp = mp->b_next; 17 } 18 } else { 19 mp = mp->b_next; 20 } 21 } 22 /* End of region that must be protected */ When using rmvq(), 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
freemsg(9F), getq(9F), insq(9F) Writing Device Drivers STREAMS Programming Guide WARNINGS
Make sure that the message mp is linked onto q to avoid a possible system panic. SunOS 5.10 9 Jul 2001 rmvq(9F)
All times are GMT -4. The time now is 07:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy