I have a text that I'm trying to format into something more readable. However, I'm stuck in the last step. I've searched and tried things over the internet with no avail.
OS: Mac
After parsing the original text that I won't put here, I managed to get something like this, but this isn't what I need yet.
The problem is that this text is kind of upside down.
Desired output:
What I've tried so far is embarrassing ..
awk '/says:/ {NR>2;c=$0;print c,NR-2}' file
This won't work. I've tried many others examples on the internet but they didn't work and I quite didn't understand them either.
An original sample file input would be:
The desired output should be something like:
This is the log of a conversation that I need to convert into a decent, readable form for others. Anyways, any help is much appreciated.
Last edited by RudiC; 12-25-2018 at 06:36 PM..
Reason: Corrected ICODE tags
How can you tell how much a Solaris box is swapping? At what point do page in and page out become a problem? Here is a vmstat output.
> vmstat
procs memory page disk faults cpu
r b w swap free re mf pi po fr de sr m0 m1 m2 m3 in sy cs us sy id... (1 Reply)
Hello!
Why does my SuSE GNU/Linux machine swap?
I have a Gig of ram, currently 14MBs of free RAM, 724MB - buffers and caches...
That is 685MB of cached RAM, then kernel really should'nt have to swap, It should release cached memory in my thinkin...
It has only swaped 3MB's but still,... (3 Replies)
I made a script that can swap info on two lines using a combination of awk and sed, but was hoping to consolidate the script to make it run faster. If found this script, but can't seem to get it to work in a bash shell. I keep getting the error "Too many {'s". Any help here would be appreciated:... (38 Replies)
I'm a bit new to regex and sed/perl stuff, so I would like to ask for some advice. I have tried several variations of scripts I've found on the net, but can't seem to get them to work out just right.
I have a file with the following information...
# Host 1
host 45583 {
filename... (4 Replies)
I have some text:
<date>some_date</date>
<text>some_text</text>
<name>some_name<name>
and I want to transform it to smthng like that:
some_name on some_date: some_text
I've tried sed:
sed 's/<text>\(.*\)<\/text>
<name>\(.*\)<\/name>/\2 - \1/'
but it says unterminated... (13 Replies)
Hi All,
Sorry if this question has been posted elsewhere, but I'm hoping someone can help me! Bit of an AWK newbie here, but I'm learning (slowly!)
I'm trying to cobble a script together that will save me time (is there any other kind?), to swap two fields (one containing whitespace), with... (5 Replies)
Hallo Team,
This is the command that i am running :
grep ",Call Forward Not Reachable" *2013*
this is the output that i am getting (i did a head -10 but the files can be more than 1000)
... (8 Replies)
How can you swap the first 4 line only, the rest will stay the same.
thanks
#!/bin/sh
line=4
awk -v var="$line" 'NR==var {
s=$0
getline;s=$0"\n"s
getline;print;print s
next
}1' fileko.tx
.
desired output: (8 Replies)
Hi Guys
I am using SPARC-T4 (chipid 0, clock 2998 MHz), SunOS 5.10 Generic_150400-38 sun4v.
How do I see if the server was doing some swapping like yesterday?
I had a java application error with java.lang.OutOfMemoryError, now I want to check if the server was not doing some swapping at... (4 Replies)
Discussion started by: Phuti
4 Replies
LEARN ABOUT FREEBSD
pppctl
PPPCTL(8) BSD System Manager's Manual PPPCTL(8)NAME
pppctl -- PPP control program
SYNOPSIS
pppctl [-v] [-t n] [-p passwd] [host:]Port | LocalSocket [command[;command]...]
DESCRIPTION
This utility provides command line control of the ppp(8) daemon. Its primary use is to facilitate simple scripts that control a running dae-
mon.
The pppctl utility is passed at least one argument, specifying the socket on which ppp is listening. Refer to the 'set server' command of
ppp for details. If the socket contains a leading '/', it is taken as an AF_LOCAL socket. If it contains a colon, it is treated as a
host:port pair, otherwise it is treated as a TCP port specification on the local machine (127.0.0.1). Both the host and port may be speci-
fied numerically if you wish to avoid a DNS lookup or do not have an entry for the given port in /etc/services.
All remaining arguments are concatenated to form the command(s) that will be sent to the ppp daemon. If any semi-colon characters are found,
they are treated as command delimiters, allowing more than one command in a given 'session'. For example:
pppctl 3000 set timeout 300; show timeout
Do not forget to escape or quote the ';' as it is a special character for most shells.
If no command arguments are given, pppctl enters interactive mode, where commands are read from standard input. When reading commands, the
editline(3) library is used, allowing command-line editing (with editrc(5) defining editing behaviour). The history size defaults to 20
lines.
The following command line options are available:
-v Display all data sent to and received from the ppp daemon. Normally, pppctl displays only non-prompt lines received. This option is
ignored in interactive mode.
-t n Use a timeout of n instead of the default 2 seconds when connecting. This may be required if you wish to control a daemon over a
slow (or even a dialup) link.
-p passwd
Specify the password required by the ppp daemon. If this switch is not used, pppctl will prompt for a password once it has success-
fully connected to ppp.
ENVIRONMENT
The following environment variables are understood by pppctl when in interactive mode:
EL_SIZE The number of history lines. The default is 20.
EL_EDITOR The edit mode. Only values of "emacs" and "vi" are accepted. Other values are silently ignored. This environment variable will
override the bind -v and bind -e commands in ~/.editrc.
EXAMPLES
If you run ppp in -auto mode, pppctl can be used to automate many frequent tasks (you can actually control ppp in any mode except interactive
mode). Use of the -p option is discouraged (even in scripts that are not readable by others) as a ps(1) listing may reveal your secret.
The best way to allow easy, secure pppctl access is to create a local server socket in /etc/ppp/ppp.conf (in the correct section) like this:
set server /var/run/internet "" 0177
This will instruct ppp to create a local domain socket, with srw------- permissions and no password, allowing access only to the user that
invoked ppp. Refer to the ppp(8) man page for further details.
You can now create some easy-access scripts. To connect to the internet:
#! /bin/sh
test $# -eq 0 && time=300 || time=$1
exec pppctl /var/run/internet set timeout $time; dial
To disconnect:
#! /bin/sh
exec pppctl /var/run/internet set timeout 300; close
To check if the line is up:
#! /bin/sh
pppctl -p '' -v /var/run/internet quit | grep ^PPP >/dev/null
if [ $? -eq 0 ]; then
echo Link is up
else
echo Link is down
fi
You can even make a generic script:
#! /bin/sh
exec pppctl /var/run/internet "$@"
You could also use pppctl to control when dial-on-demand works. Suppose you want ppp to run all the time, but you want to prevent dial-out
between 8pm and 8am each day. However, any connections active at 8pm should continue to remain active until they are closed or naturally
time out.
A cron(8) entry for 8pm which runs
pppctl /var/run/internet set filter dial 0 deny 0 0
will block all further dial requests, and the corresponding 8am entry
pppctl /var/run/internet set filter dial -1
will allow them again.
SEE ALSO ps(1), editline(3), editrc(5), services(5), ppp(8)HISTORY
The pppctl utility first appeared in FreeBSD 2.2.5.
BSD June 26, 1997 BSD