Tag Info

Hot answers tagged

8

With sed: sed '$!N;/remove/!P;D' infile This pulls the Next line into pattern space (if not ! on la$t line) and checks if pattern space matches remove. If it doesn't (means none of the two lines in the pattern space contains the string remove) it Prints up to the first \newline character (i.e. it prints the first line). Then it Deletes up to the first ...


4

awk ' !/remove/ && NR > 1 && prev !~ /remove/ {print prev} {prev = $0} END {if (!/remove/) print} ' Input.txt


4

GNU stat is available in the SUNWgnu-coreutils package. If you're not able to install that, the pkgproto command is an alternative. From the manual page: pkgproto /bin=bin /usr/bin=usrbin /etc=etc f none bin/sed=/bin/sed 0775 bin bin f none bin/sh=/bin/sh 0755 bin daemon f none bin/sort=/bin/sort 0755 bin bin f none usrbin/sdb=/usr/bin/sdb 0775 ...


4

Use auditing. Solaris Auditing (Overview) Auditing generates audit records when specified events occur. Most commonly, events that generate audit records include the following: System startup and system shutdown Login and logout Process creation or process destruction, or thread creation or thread destruction Opening, closing, creating, ...


3

You can change the default colors of your terminal emulator, whether it is dtterm, gnome-terminal or even xterm (reverse-video), using its configuration menu. Solaris 10 standard System V vi doesn't support syntax coloring. You need to install and use vim or elvis to get it.


2

It means that the filesystem that is mounted on /hgfs (a filesystem of type vmhgfs, the VMware host/guest filesystem) doesn't support the stat system call. stat is used to return details about nodes on a filesystem and there's no requirement that every filesystem support it. You can ignore the error message. If you won't want it appearing in the output of ...


2

Don't (directly) delete the snapshots (moreover clones) the other replies are suggesting you to do. Your server has multiple boot environments. You can list them with this command: beadm list If you do not need to rollback to a previously created boot environment, you can remove it with this command: beadm destroy boot-environment-name


2

gawk 'BEGIN{ RS="remove\n"; ORS="" } RT{ print gensub("[^\n]*\n$","","") }; !RT{ print }' file The above method does not read Records line-by-line, rather it reads multi-line Records from one Record Separator (RS) to the next (or end-of-file) – the RS being the "remove" line itself (including its trailing `\n). The !RT test is needed for when the ...


2

What security property do you want? HTTPS with a verified certificate provides cryptographic assurance that the server is the expected one. If you need this level of assurance, then self-signed certificates won't do unless they're pre-shared. If you have pre-shared certificates, pass them to wget with the --ca-certificate option. Without HTTPS, a request ...


1

You don't mention which filesystem type. If it's ufs rather than zfs, the UFS Explorer product may be able to restore the file.


1

Pure ksh93 solution: FIGNORE='@(.|..)' for dir in */; do a=( "$dir"/**/* ); printf "%s\t%s\n" "$dir:" "${#a[*]}"; done Result from /usr/src: linux-3.17.7-gentoo/: 561 linux-3.5.7-gentoo/: 517 linux-3.7.10-gentoo/: 505 linux-3.7.9-gentoo/: 513 linux-3.8.13-gentoo/: 551 linux-4.0.5-gentoo/: 1849


1

Will something like this suit your need: The path /boot is used for sample demonstration. Change it to the directory you need. for DIR in $(find /boot/* -maxdepth 1 -type d) do printf "%40s: %10d\n" "${DIR}" $(find ${DIR}|wc -l) done Output: /boot/grub: 282 /boot/grub/fonts: 2 ...


1

You could find the toplevel directories first, then use a second find, to count the number of files and directories within the toplevel directory: $ for dir in $(find . -maxdepth 1 ! -path . -type d | sort); \ do echo -n "$dir " && find $dir ! -path . | wc -l ; done ./adir 1151 ./anotherdir 140 ./623de41e44 280 ./examples 154 ...


1

Piping an input file into a read command is generally a recipe for disaster, it can work in some circumstances, but in many cases it does not. Best to learn a more consistent way of doing this. Here are a couple of simple alternatives... nawk '{print $1}' $( cat input.txt ) > output.txt or if you want it in a loop... for FILENAME in $( cat input.txt ...


1

I guess you mean Solaris 11.2 as Solaris 12 is not yet released, possibly next year (2016) according to a roadmap. /usr/bin/kstat is a Perl script in Solaris 11.2 so while still proprietary code, you can certainly read its source code. An alternative, C based open source version of the kstat command is available here ...


1

from NFS server, try netstat -an | grep 2049 you should see something like *.2049 *.* 0 0 49152 0 LISTEN 10.12.13.97.2049 10.12.13.90.914 49640 0 49640 0 ESTABLISHED first line saysthat nfsd (service number 2049) is listening on all interfaces *.2049 LISTEN next line says there is a ...


1

zfs list report it rpool/ROOT 31.9G 11.3G 31K legacy rpool/ROOT/solaris-7 95.3M 11.3G 8.57G / rpool/ROOT/solaris-7/var 27.1M 11.3G 20.5G /var rpool/ROOT/solaris-8 31.8G 11.3G 5.95G / rpool/ROOT/solaris-8/var 21.0G 11.3G 285M /var as told by @andrew this is old snapshot, if you ...


1

You missed snapshots and/or clones. Examine the output from zfs list -t all.


1

Another sed: sed '$!N;/\n,/s/\([^,]*\).*\n/&\1/;P;D' <in >out For each input line which is ! not the $ last, sed will append the Next input line to pattern space as preceded by a \newline character. It will then attempt a s///ubstitution which involves copying the first possible group of ^, not-comma characters to the space just preceding a ...


1

With sed: sed '/^[0-9]/{ # if line starts with digit h # overwrite hold buffer with pattern space content s/\([^,]*\),.*/\1/ # extract timestamp x # exchange: put the original line back into pattern } # space and the timestamp in hold space /^,/{ ...



Only top voted, non community-wiki answers of a minimum length are eligible