Search Results

Search: Posts Made By: mohtashims
280
Posted By MadeInGermany
The shorter pathnames is a small improvement only...
The shorter pathnames is a small improvement only when post processing the output.
Then, you can bundle the names (shortens the command, not so much the run time).
But a + instead of the \; will...
387
Posted By Scrutinizer
Ah so it is the other way around? The hostname is...
Ah so it is the other way around? The hostname is always lowercase, but the path may be uppercase?

Try something like:
cd $(ls -d "$(hostname)"* "$(hostname | tr '[[:lower:]]' '[[:upper:]]')"*...
Forum: Shell Programming and Scripting 4 Weeks Ago
1,063
Posted By RudiC
There seems to be a mixup between shell globs and...
There seems to be a mixup between shell globs and grep / regex patterns. Try grep 'body.*.xml'.


Or, recent bashes provide "extended pattern matching" if the extglob shell option is set:
shopt...
2,064
Posted By Corona688
If your values will never contain spaces, you can...
If your values will never contain spaces, you can "pass" arrays as strings "val1 val2 val3" and split them back inside the function, like this:

#!/bin/ksh

set -A filelist val1 val2 val3
set -A...
1,907
Posted By apmcd47
I was going to say I agree with RudiC, but...
I was going to say I agree with RudiC, but realise $LINE should be a subset of $1, not the other way round, so Rudi's solution probably won't get the results you want. So let's look at what is wrong...
1,915
Posted By MadeInGermany
grep for items ending with a : grep ':$' The...
grep for items ending with a :
grep ':$'
The $ indicates the line end.
But doesn't the -p option let the ls command add a / to the end of directory names?
Then grep -v '/$' or grep '[^/]$' can...
2,087
Posted By MadeInGermany
ksh does not have the <<< (here string) operator....
ksh does not have the <<< (here string) operator. (An exception are few variants of ksh93.)
In ksh you can do
echo "$var" |
while IFS= read -r dirpath
do
echo "Hi"
done
Note that ksh,...
2,394
Posted By Chubler_XL
I believe perl is available on default AIX...
I believe perl is available on default AIX installations so this could be used to fetch the file modification time eg:

perl -e 'use POSIX qw(strftime);use File::stat; print strftime($ARGV[0],...
2,394
Posted By MadeInGermany
Try the following echo "$(find...
Try the following
echo "$(find /app/logs/fname1.out -ls) $(cksum<fname1.out | cut -d' ' -f1)"
Too much information? Pipe the find output to cut and select the desired fields! (Like you do with the...
1,237
Posted By Neo
Maybe it's because you do not understand...
Maybe it's because you do not understand computers and the basics on how to use them?

For example, if you understood computers, you would tell us exactly what computer use are using and any error...
2,103
Posted By MadeInGermany
The echo command is not portable. Use printf...
The echo command is not portable.
Use printf "%s\n" instead.
cat check.sh
str=`printf "%s\n" "$1" | sed -e 's#\\\\n# #g'`
printf "%s\n" "$str"
str=$(printf "%s\n" "$1" | sed -e 's#\\\\n# #g')...
2,119
Posted By anbu23
$ echo '/fin/app/scripts\\n/fin/app/01/sql' | sed...
$ echo '/fin/app/scripts\\n/fin/app/01/sql' | sed -e 's#\\\\n# #g';
/fin/app/scripts /fin/app/01/sql
$ echo '/fin/app/scripts\\n/fin/app/01/sql' > file
$ sed -e 's#\\\\n# #g' file...
1,891
Posted By rdrtx1
try: if [ "$line" != "\n" ] in case $line is an...
try: if [ "$line" != "\n" ] in case $line is an empty string.
1,950
Posted By Chubler_XL
yes use %h/%f instead of %f: find...
yes use %h/%f instead of %f:

find /app/logs/fname1.out -printf "%M %u %TY-%Tm-%Td %TH:%TM %h/%f $(cksum<fname1.out | cut -d' ' -f1)\n"
1,950
Posted By Chubler_XL
ls will change the time column format depending...
ls will change the time column format depending on the age of the file eg:

-rw-r--r-- 1 root root 89 Aug 29 12:08 booking
-rw-r--r-- 1 root bin 0 Oct 21 2016 basic.log

do you want this in...
1,138
Posted By Don Cragun
So use: awk '{$2=$4=$5=x; print}'
So use:
awk '{$2=$4=$5=x; print}'
2,013
Posted By Peasant
Your sed is not quoted properly. Try tr,...
Your sed is not quoted properly.

Try tr, which is used for such manipulation, with sed to remove blank begining of line.

echo $FPATH | tr "'" "\n" | sed "s/^ //g"


Also, you must enclose...
2,013
Posted By RudiC
Try printf -- $i to eliminate that bash: printf:...
Try printf -- $i to eliminate that bash: printf: -r: invalid option problem incorrectly cited by you. Still, your entire code wouldn't work as
- you don't create an array
- even if you created an...
2,325
Posted By RudiC
Sometimes, reading man pages really helps. man...
Sometimes, reading man pages really helps. man sed:
Looks like you need to escape the first colon.
2,591
Posted By apmcd47
First, you need to quote your input: ./test.sh...
First, you need to quote your input:
./test.sh "[u/tmp/file.js, u/var/test.txt, u/tmp/llo.rft]"

Second, don't use the shell array construct - do this instead:
#!/bin/sh

FPATH="$1"

printf...
2,321
Posted By Corona688
Then I would suggest posting a sample of what...
Then I would suggest posting a sample of what that looks like so we can contemplate ways to deal with it. Post what it looks like in the tool, and the actual arguments the shell receives.

OP's...
286
Posted By Neo
Update, mohtashims, I thought I would Google...
Update, mohtashims, I thought I would Google this for you and found a great little tutorial for you on this topic::

How to Permanently Disable Swap in Linux...
286
Posted By Neo
In my opinion, the you should change your config...
In my opinion, the you should change your config settings to not to mount the swap space when the system boots, then do an orderly shutdown and reboot.

Then you will be OK.

Sorry, I did not...
305
Posted By jim mcnamara
I would start by looking for sudo logged events ...
I would start by looking for sudo logged events

redhat based linux systems like centos

/var/log/secure

debian based OS like ubuntu

/var/log/auth.log
224
Posted By Scrutinizer
-eq does not exist in a double bracket...
-eq does not exist in a double bracket expression, hence the syntax error. Either use (pattern matching)
if [[ $whichenv == 9 ]]
or (arithmetic comparison expression)
if (( whichenv == 9 ))
...
Showing results 1 to 25 of 245

 

Featured Tech Videos

All times are GMT -4. The time now is 01:37 PM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy