Sponsored Content
Top Forums Shell Programming and Scripting how to write on separate lines? Post 302689709 by Sunusernewbie on Wednesday 22nd of August 2012 02:49:51 AM
Old 08-22-2012
how to write on separate lines?

Hello friends,
I have a file "a.txt" its contents
-----------------
pid 4075 (caiopr) shmat(1929379932, 0x0000000000000000, 0) = 0x00000000ff030000 (errno 0) pid 4075 (caiopr) shmdt(0x00000000ff030000) = 144 (errno 0) pid 4075 (caiopr) shmctl(1929379932, IPC_RMID) pid 4205 (cau9cli.exe) shmget(13, 0, 438) = 1 (errno 0) pid 4205 (cau9cli.exe) shmat(1, 0x0000000000000000, 0) = 0x00000000fea90000 (errno 0) pid 4205 (cau9cli.exe) shmdt(0x00000000fea90000) = 144 (errno 0) pid 4205 (cau9cli.exe) shmget(13, 0, 438) = 1 (errno 0) pid 4205 (cau9cli.exe) shmat(1, 0x0000000000000000, 0) = 0x00000000fea90000 (errno 0) pid 4205 (cau9cli.exe) shmget(0, 539, 1974) = 1929379932 (errno 0) pid 4205 (cau9cli.exe) shmat(1929379932, 0x0000000000000000, 0) = 0x00000000fee90000 (errno 0) pid 4205 (cau9cli.exe) shmdt(0x00000000fee90000) = 144 (errno 0) pid 4205 (cau9cli.exe) shmdt(0x00000000fea90000) = 144 (errno 0)
================

I want to know a command/ script which will format this a.txt such that each line will start with pid, please let me know.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Separate lines in a single '|' separated line

Hi I have a file with contents like china india france japan italy germany . . . . etc.... I want the output as china|india|france|japan|italy|germany|.|.|. (3 Replies)
Discussion started by: hidnana
3 Replies

2. Shell Programming and Scripting

diplay user process in separate lines

hi I m trying to display the processes of each user but its coming in one line like george wilkins PID TTY TIME CMD 7661 ? 00:00:01 sshd 7662 pts/6 00:00:00 bash i want the output to be like PID TTY TIME CMD 7661 ? 00:00:01 sshd 7662 pts/6 00:00:00 bash my code is proc=$(users)... (5 Replies)
Discussion started by: mathur
5 Replies

3. Shell Programming and Scripting

How to get 2 records in 2 separate lines in the mail

export VarMailAddress=abc@gmail.com export SUBJECT="Hi" ( echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo "Content-Disposition: inline" echo "<HTML><BODY>" echo "<B> <U>NAME&nbsp;&nbsp;ID&nbsp;&nbsp;Address </B> <br /> " echo "`cat FILE`" echo... (4 Replies)
Discussion started by: siri_886
4 Replies

4. Shell Programming and Scripting

Direct the invalid lines to a separate files

Hi, I have a pipe delimited file with 1 million records. I need to validate each line by counting the number of delimiters, if any line fails to have the specified number of delimiters, taat line has to be sent to a reject file. Kindly suggest. if code provided, it is highly appreciated, and... (22 Replies)
Discussion started by: anandapani
22 Replies

5. Shell Programming and Scripting

Separate lines from text file

I have a text file with lot of rows like.. Action & Adventure|2012: Supernova NR|2009-11-01 00:01:00|2010-05-01 23:59:00|Active|3 Action & Adventure|50 Dead Men Walking|2010-01-05 00:01:00|2010-06-30 23:59:00|Active|3 Action & Adventure|Afterwards|2009-11-26 00:01:00|2010-03-26... (3 Replies)
Discussion started by: ramse8pc
3 Replies

6. Shell Programming and Scripting

Combine the lines from separate text files

Hi All, I have three separate text files which has only one line and i want to combine these lines in one text file which will have three lines. cat file1.txt abc cat file2.txt 1265 6589 1367 cat file3.txt 0.98 0.36 0.5 So, I want to see these three lines in the... (9 Replies)
Discussion started by: senayasma
9 Replies

7. Shell Programming and Scripting

loop through lines and save into separate files

I have two files: file-gene_families.txt that contains 30,000 rows of 30 columns. Column 1 is the ID column and contains the Col1 Col2 Col3 ... One gene-encoded CBPs ABC 111 ... One gene-encoded CBPs ABC 222 ... One gene-encoded CBPs ABC 212 ... Two gene encoded CBPs EFC... (7 Replies)
Discussion started by: yifangt
7 Replies

8. Shell Programming and Scripting

[Solved] Pattern match and write to separate files

I need to parse a file and depending on a patern match(in the insert job line) separate files have to be created with a line added (content in file2). Mapping for pattern match and add line : for Alpha 123 for Beta 234 for Gamma 345 no match (goes into another file) File 1 ... (3 Replies)
Discussion started by: w020637
3 Replies

9. Programming

Separate input buffer into multiple lines

Hi All I have a very tricky problem, not able to solve it. Hence asking this question. I have a code portion like this - int parse_msg(in_buf,line1,line2,sccs_line) char in_buf; char line1; char line2; char sccs_line; { .... (void)fprintf(trace_fp,"parse_msg1 in_buf = %s \n",... (0 Replies)
Discussion started by: nsinha
0 Replies

10. UNIX for Beginners Questions & Answers

Ls to text file on separate lines

hi, I'm trying to print out the contents of a folder into a .txt file. The code I'm trying amongst variations is: ls -1 > filenames.txt but it prints them all on the same line ie. image102.bmpimage103.bmpimage104.bmpimage105.bmpimage106.bmp how can I change this? Please... (2 Replies)
Discussion started by: newbie100
2 Replies
shmdt(2)							System Calls Manual							  shmdt(2)

NAME
shmdt - Detaches a shared memory region SYNOPSIS
#include <sys/shm.h> int shmdt( const void *addr); Application developers may want to specify #include statements for <sys/types.h> and <sys/ipc.h> before the one for <sys/shm.h> if programs are being developed for multiple platforms. The additional #include statements are not required on Tru64 UNIX systems or by ISO or X/Open standards, but may be required on other vendors' systems that conform to these stan- dards. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: shmdt(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the starting virtual address for the shared memory region to be detached. This is the address returned by a previous shmat() call. DESCRIPTION
The shmdt() function detaches the shared memory region at the address specified by the addr parameter. Other instances of the region attached at other addresses are unaffected. RETURN VALUES
Upon successful completion, the shmdt() function decrements the value of shm_nattach in the data structure associated with the shared mem- ory ID of the attached shared memory segment and returns 0 (zero). Upon failure, the shared memory segment is not detached, -1 is returned, and errno is set to indicate the error. ERRORS
The shmdt() function sets errno to the specified values for the following conditions: The addr parameter does not specify the starting address of a shared memory region. RELATED INFORMATION
Functions: shmat(2), shmctl(2), shmget(2) Data structures: shmid_ds(4) Standards: standards(5) delim off shmdt(2)
All times are GMT -4. The time now is 01:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy