03-21-2010
Can sed be used to insert data at specific column?
I'm trying to use sed to insert data at a specific column, let's say my data looks like this:
0553 1828
0552 1829
0550 1829
0549 1830
0548 1831
what I want is this:
timein 0553 timeout 1828
timein 0552 timeout 1829
timein 0550 timeout 1829
timein 0549 timeout 1830
timein 0548 timeout 1831
So inserting at a beginning of a line is easy, that would be:
cat inputfile | sed 's/^/timein /g' > outputfile
it's inserting the "timeout" that throwing me. Any help would be appreciated.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to edit my /etc/shadow file globally to make each line change from:
rrrtest:BBBuhiD49QA:12881::::::
rtest1:.GHXbqSCYU:12935::::::
To
rrrtest:BBBuhiD49QA:12881::90:90:::
rtest1:.GHXbqSCYU:12935::90:90:::
I only want to change those columns.
Any help or guidance would be... (7 Replies)
Discussion started by: tercex11
7 Replies
2. Shell Programming and Scripting
Hi,
I am having trouble converting a text file. I have been working for this whole day now, still i couldn't make it.
Here is how the text file looks:
_______________________________________________________
DEVICE STATUS INFORMATION FOR LOCATION 1:
OPER STATES: Disabled E:Enabled ... (5 Replies)
Discussion started by: Issemael
5 Replies
3. Shell Programming and Scripting
So I work in a 1 to 1 laptop deployment and sometimes we need to mass order parts. The vendor will send us a text file and we have to manually input serial numbers. Well I have a full blown web based inventory system which I can pull serial number reports from.
I then have to input the part... (4 Replies)
Discussion started by: tlarkin
4 Replies
4. Shell Programming and Scripting
Hi all,
i have data like this
joe : 1 :a
bob : 2 :b
sue : 3 :c
foo : 4 :d
at column 2 i want to insert TOP to the top column and at column 3 i want to insert BOTTOM to the bottom column. and the result will... (12 Replies)
Discussion started by: psychop13
12 Replies
5. Shell Programming and Scripting
Can anyone please help with this? I have 2 files as given below.
If 2nd column of file1 has pattern foo1@a, find the matching 1st column in file2 & replace 2nd column of file1 with file2's value.
file1
abc_1 foo1@a ....
abc_1 soo2@a ...
def_2 soo2@a ....
def_2 foo1@a ........ (7 Replies)
Discussion started by: prashali
7 Replies
6. Shell Programming and Scripting
Hi,
I want to insert the text 'Unknown' in 2 specific columns in a csv file (actually | separated) if the column is blank. Its always the same columns.
I have tried using sed: sed "s/||/|Unknown|/g"
but there are occasion where other fields are blank and they need to be left blank. This... (4 Replies)
Discussion started by: ksexton
4 Replies
7. Shell Programming and Scripting
I have the following data:
Dec 24 11:31:10 0000008b 9911662486 Answered Price SGD 0.003 PERIOD: 0 m 6 s
Dec 24 11:21:42 00000086 9911662486 Answered Price SGD 0.001 PERIOD: 0 m 2 s
Dec 20 15:34:28 00000004 9911662486 Answered Price SGD 0.007 PERIOD: 0 m 12 s
Dec 20 18:42:30 0000017b... (6 Replies)
Discussion started by: alegnagrp
6 Replies
8. Shell Programming and Scripting
Hello,
I have some problem in inserting the space for the pairs of columns.
I have the input file :
I used this code below in replacing it using space in specific column (replace space in each two columns)
sed -e "s/,/ /2" -e "s/,/ /3" inputfile
Output showed :
However, I have many... (3 Replies)
Discussion started by: awil
3 Replies
9. Shell Programming and Scripting
Dear Team
I need to insert field(which is need to taken from previous line's first field) in first column if its blank. I had tried using sed but not find the way. Detail input and output file as below.
Kindly help for same.
INPUT:
SCGR SC DEV DEV1 NUMDEV DCP ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies
10. UNIX for Beginners Questions & Answers
Source Code of the original script is down below please run the script and try to solve this problem
this is my data and I want it column wise
2019-03-20 13:00:00:000
2019-03-20 15:00:00:000
1
Operating System
LAB
0
1
1
1
1
1
1
1
1
1
0
1 (5 Replies)
Discussion started by: Shubham1182
5 Replies
LEARN ABOUT PLAN9
ssl_ctx_set_timeout
SSL_CTX_set_timeout(3SSL) OpenSSL SSL_CTX_set_timeout(3SSL)
NAME
SSL_CTX_set_timeout, SSL_CTX_get_timeout - manipulate timeout values for session caching
SYNOPSIS
#include <openssl/ssl.h>
long SSL_CTX_set_timeout(SSL_CTX *ctx, long t);
long SSL_CTX_get_timeout(SSL_CTX *ctx);
DESCRIPTION
SSL_CTX_set_timeout() sets the timeout for newly created sessions for ctx to t. The timeout value t must be given in seconds.
SSL_CTX_get_timeout() returns the currently set timeout value for ctx.
NOTES
Whenever a new session is created, it is assigned a maximum lifetime. This lifetime is specified by storing the creation time of the
session and the timeout value valid at this time. If the actual time is later than creation time plus timeout, the session is not reused.
Due to this realization, all sessions behave according to the timeout value valid at the time of the session negotiation. Changes of the
timeout value do not affect already established sessions.
The expiration time of a single session can be modified using the SSL_SESSION_get_time(3) family of functions.
Expired sessions are removed from the internal session cache, whenever SSL_CTX_flush_sessions(3) is called, either directly by the
application or automatically (see SSL_CTX_set_session_cache_mode(3))
The default value for session timeout is decided on a per protocol basis, see SSL_get_default_timeout(3). All currently supported
protocols have the same default timeout value of 300 seconds.
RETURN VALUES
SSL_CTX_set_timeout() returns the previously set timeout value.
SSL_CTX_get_timeout() returns the currently set timeout value.
SEE ALSO
ssl(3), SSL_CTX_set_session_cache_mode(3), SSL_SESSION_get_time(3), SSL_CTX_flush_sessions(3), SSL_get_default_timeout(3)
1.0.1e 2013-02-11 SSL_CTX_set_timeout(3SSL)