New answers tagged

1

As stated by steeldriver, if you use GNU sed, you can tell which occurrence should be replaced, e.g.: echo "/test/test/ 12 /test/test" | sed -n -e 's_/._/_2 p' If you can not make use of this feature you can also write: echo "/test/test/ 12 /test/test" | sed -n -r -e 's_(/[a-z]([a-z]+))\1_\1/\2_ p' Biliography: http://www.grymoire.com/Unix/Sed.html ...


0

echo "/test/test/ 12 /test/test" | sed 's/\/test\/t/\/test\//'


3

My advice is keep things simple. Don't write a whole script when there is a ready-made tool that already does what you want. du is the tool for reporting on disk usage, and find is the tool for finding files. Use them together. find dirname* -mindepth 1 -maxdepth 1 -type d -exec du -hs {} \; -maxdepth and -mindepth are GNU extensions; to handle this ...


0

Add a grep command to filter the generated passwords for those which contain the special characters: LC_ALL=C </dev/urandom tr -cd '_a-zA-Z0-9-\?\!\=\/' | \ fold -w15 | grep '[\?\!\=\/]' | head -1 NOTES: I added LC_ALL=C because, depending on the system's locale, tr will produce the error Illegal byte sequence if presented with binary data (as ...


7

Ctrl+R works with ksh in emacs mode (ksh -o emacs or set -o emacs within ksh), and it was most probably the first shell to support it. Only it's not as interactive as in zsh or bash or tcsh's i-search-back widget. In ksh (both ksh88 and ksh93), you type Ctrl+RtextReturn. And Ctrl+RReturn to search again with the same text. In vi mode, you can use ? to ...


4

The Korn shell does support history searches using CtrlR, at least since ksh93 (and perhaps even ksh88), but they don't work quite like bash. First you need to enable Emacs mode: set -o emacs (This enables other niceties, such as arrow keys working by default.) Now if you press CtrlR, the shell will print ^R; type your search, hit Enter, and the shell ...


-1

In the 1970s there was no cursor editable history for shells. The first shell with integrated cursor editable history was my bsh in 1984 (based on a prototype from 1982). This history implementation uses crontrol-r to redisplay the current commandline. In 1986, the Korn Shell became a member of the group of shells that implement a fully integrated cursor ...


0

find . -maxdepth 1 -name PYRLLPS_GL_201610D2* -mtime -30 If you want to find file named like PYRLLPS_GL_201610D2AAAA ,you need the code: find . -maxdepth 1 -name 'PYRLLPS_GL_201610D2*' -mtime -30


0

-maxdepth is not specified by POSIX. It appears your version of find doesn't support that primary. Ways to accomplish the same effect using only POSIX options are discussed here: Limit POSIX find to specific depth? Also, it's unclear what you're trying to do but you may have the usage of find itself confused: If you are trying to find all files with ...


1

works fine when executed in terminal. but when i add to my existing shell script which is running as a concurrent program, the program errors out throwing the error "Bad substitution". Syntax errors in a script? That usually indicates that you aren't using the same shell for the script and interactively. #Parameters : Takes the following input ...


0

You can use Vim in Ex mode: ex -sc '1d|x' file.txt 1 find first line d delete x save and close


0

The reset command won't help with cleanup from resizing. The resize command can be helpful, but there is a pitfall. There are two main use-cases for resize: telling the system how large the screen is when it cannot tell, e.g., connecting through a serial interface with no NAWS (negotiations about window size) support. This is useful for FAQs. repairing ...


0

I know this is really late, but perhaps you can work around your issue of making the underscore more accessible. xmodmap -e "keycode 20 = underscore minus" This will switch underscore with hyphen (minus). So now, you hold shift for hyphen, but an underscore is typed without shift. Your keycode may be different, however, I think it depends on your ...


2

Try something like this: SLAPD='/usr/bin/slapd' SERVICE='ldap://localhost:10389 ldaps://solsrv02.internal.vbox:10689 ldaps://solsrv02.prod.internal.vbox:10689' SLAPDARGS="-u '${LDAPUSR}'" SLAPDARGS+=" -g '${LDAPGRP}'" SLAPDARGS+=" -h '${SERVICE}'" SLAPDARGS+=" -F '${CONFDIR}'" $SLAPD $SLAPDARGS Just so you can see what that does (when run after ...



Top 50 recent answers are included