I have a configuration file that when a certain script runs in updates. I want to use sed and can't seem to get the syntax right.
A line from the configuration file looks like:
DATE=20040909 12:00:10
When the script is run I want to change the date and time, i.e. removing the previous... (7 Replies)
hello!
I have a few sed commands
sed '/^$/d' < $1 > tmp.t
sed '/^ \{3,\}/d' < tmp.t > tmp1.txt
.....
how can I write them in a single line?
sed '/^$/d' < $1 > | '/^ \{3,\}/d' < $1 > tmp1.txt
any idea?
thanks. (5 Replies)
I would like to change the lines:
originalline1
originalline2
to:
originalline1new
originalline1newline
originalline2new
originalline2newline
To do this, id like to combine the commands:
sed 's/^/&new/g' file > newfile1
and
sed '/^/ a\\
newline\\
\\ (2 Replies)
Hi there, I need to be able to put the hostid of my box into a file (replacing the text "enter_hostid_here" so i tried
sed -e 's/enter_hostid_here/`hostid`/g' inputfile > outputfile
but it takes the `hostid` literally as text .....how can I get this info into the file (ideally in a single... (2 Replies)
Hello,
from the gnu sed manual, I should be able to do this:
`\(REGEXP\)'
Groups the inner REGEXP as a whole, this is used to:
* Apply postfix operators, like `\(abcd\)*': this will search
for zero or more whole sequences of `abcd', while `abcd*'
... (3 Replies)
I run awk
cat $1|awk '{print $6}'
and get a lot of results and I want results to group them. For example my result is (o/p is unknown to user)
xyz
xyz
abc
pqr
xyz
pqr
etc
I wanna group them as
xyz=total found 7
abc=total ....
pqr=
Thank (3 Replies)
Hello
I need to run some sed commands but it involves "/" in the substitute or delete, any ideas how I get round the problem.
Example:
cat file1.txt | sed -e '/</Header>/d' > file2.txt
This errors due to the forward slash before the Header text.
Thanks (3 Replies)
Hi,
I have the following script :-
#!/bin/csh -f
set var="HOST2"
sed -e 's/\(.*TRANSFER TO\).*\(usr\)/\1 "$var" \2/' tempFile
tempFile contains:
STOP TRANSFER TO HOST1 /usr/bin/myscript
1. How to use variable in the above sed command. It replaces with $var... (6 Replies)
Hi,
I've a shell that uses two sed commands to tailor a file.
sed 's/ */ /g' | sed 's/%/%%/g'
Is it possible to merge this in to a single sed?
Thanks! (2 Replies)
I have below inside a file.
11.22.33.44
user1
11.22.33.55
user2
I need this manipulated as
alias server1.domain.com='ssh user1@11.22.33.44'
alias server2.domain.com='ssh user2@11.22.33.55' (3 Replies)
Discussion started by: anil510
3 Replies
LEARN ABOUT NETBSD
acct
ACCT(2) BSD System Calls Manual ACCT(2)NAME
acct -- enable or disable process accounting
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
int
acct(const char *file);
DESCRIPTION
The acct() call enables or disables the collection of system accounting records. If file is NULL, accounting is disabled. If file is an
existing, NUL-terminated, pathname, record collection is enabled, and for every process initiated which terminates under normal conditions an
accounting record is appended to file. Abnormal conditions of termination are reboots or other fatal system problems. Records for processes
which never terminate can not be produced by acct().
For more information on the record structure used by acct(), see /usr/include/sys/acct.h and acct(5).
This call is permitted only to the super-user.
NOTES
Accounting is automatically disabled when the file system the accounting file resides on runs out of space; it is enabled when space once
again becomes available. For this purpose, acct() creates a kernel thread called ``acctwatch''.
RETURN VALUES
On success, zero is returned. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
acct() will fail if one of the following is true:
[EACCES] Search permission is denied for a component of the path prefix, or the path name is not a regular file.
[EFAULT] file points outside the process's allocated address space.
[EIO] An I/O error occurred while reading from or writing to the file system.
[ELOOP] Too many symbolic links were encountered in translating the pathname.
[ENAMETOOLONG] A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters.
[ENOENT] The named file does not exist.
[ENOTDIR] A component of the path prefix is not a directory.
[EPERM] The caller is not the super-user.
[EROFS] The named file resides on a read-only file system.
Also, acct() fails if failed to create kernel thread described above. See fork(2) for errno value.
SEE ALSO fork(2), acct(5), sa(8)HISTORY
An acct() function call appeared in Version 7 AT&T UNIX.
BSD June 4, 1993 BSD