Search Results

Search: Posts Made By: ahamed101
2,955
Posted By Scrutinizer
@ahamed, there would be an issue if $16=0, also...
@ahamed, there would be an issue if $16=0, also there was an issue with BSD awk which did not print everything.. Rearranging your script like this, worked though:
awk -F'|' '{$0=$16}NR>1' infile |...
1,482
Posted By Scrutinizer
Based on the position in the line, if the line...
Based on the position in the line, if the line starts with "T" and there are 8 space from pos.121:
sed 's/^T\(.\{119\}\) \{8\}/T\120140331/' file
8,544
Posted By alister
-q exits immediately if a match is found, so -m1...
-q exits immediately if a match is found, so -m1 serves no purpose.

Regards,
Alister
Forum: Solaris 03-06-2014
9,625
Posted By MadeInGermany
vim -n file does not use a swap file.
vim -n file
does not use a swap file.
9,017
Posted By Don Cragun
Change: exec > >(tee...
Change:
exec > >(tee "/var/log/ScriptLogs/called_from_incrontab.log") 2>&1to:
exec > "/var/log/ScriptLogs/called_from_incrontab.log" 2>&1
2,595
Posted By Don Cragun
Yes, one of those lines is it. If you change: ...
Yes, one of those lines is it. If you change:
f0 = "" # Clear the saved line. (We do not want to print
# the current line twice if the 1st...
2,500
Posted By Don Cragun
I was working on something very similar to what...
I was working on something very similar to what RudiC posted, but he finished it before I did.

For the given sample data it won't make any difference, but to preserve the column positions if some...
8,981
Posted By Klashxx
From python shell: >>> import re >>> text =...
From python shell:
>>> import re
>>> text = '''
... @LIB ADVAPI32.dll @CAL RtlInitAnsiString @PA1 0x0012f740 @PA2 "CriticalSectionTimeout" @RET0
... @LIB ADVAPI32.dll @CAL memmove @PA1...
5,298
Posted By alister
find's use of stat is not a problem; stat is...
find's use of stat is not a problem; stat is called before any -exec can mv a pathname, since mtime must be inspected prior to making the decision to mv.

The issue is that these "Archive_*" files...
5,281
Posted By Don Cragun
Hi gencon, As Corona688 said, the getopts...
Hi gencon,
As Corona688 said, the getopts utility is used to parse command line options. When the getopts loop finishes, you should shift off the arguments that it processed and the remaining...
30,440
Posted By Chubler_XL
As I said len is overflowing, I increased the...
As I said len is overflowing, I increased the size of the buf to 256 chars and added warning if len overflows, see below.

Also note if you change the size of pat strings you need to also change...
2,395
Posted By drl
Hi. $ echo 123456789 | fold -w 3 123 456 ...
Hi.
$ echo 123456789 | fold -w 3
123
456
789
Best wishes ... cheers, drl
2,360
Posted By Jotne
Problem with upper and lowercase in awk
My awk (GNU Awk 3.1.8 on Ubuntu 12.04) seems to ignore case.

cat file
abc
ABC
aBc
123

awk '/[a-z]/&&/[A-Z]/{print $0,"[PASS]";next}{print $0,"[FAIL]"}' file

My result:abc [PASS]
ABC...
2,360
Posted By Franklin52
It has to do with locales as Scrutinizer...
It has to do with locales as Scrutinizer mentioned:

Ranges and Locales - The GNU Awk User's Guide (http://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html#Ranges-and-Locales)
4,327
Posted By Yoda
Set escape to ON and try: Out=$(sqlplus -s...
Set escape to ON and try:
Out=$(sqlplus -s xxxx/xxxx@xxxx <<EOF
set pagesize 0 LINESIZE 1000 feedback off verify off heading off echo off escape on
select count(1) from dual where dummy = \'X\';...
3,329
Posted By rbatte1
Ask your DBA what account the database runs as. ...
Ask your DBA what account the database runs as. If you are the DBA, ask the OS SysAdmin. If you are both, then ........ :eek:

You will need to know who runs the database, not the user running...
6,690
Posted By Just Ice
first off, assistance you receive on this website...
first off, assistance you receive on this website is offered by unpaid volunteers on their own time -- that includes me -- so it would be good to maintain a professional tone ...

second, your...
Forum: What is on Your Mind? 04-12-2013
2,049
Posted By Yoda
I totally agree with hanson44 that one-liners...
I totally agree with hanson44 that one-liners usually becomes too cryptic for OPs.

It will be a pretty much straightforward solution, but putting all steps in a line can drive them crazy.

So...
3,864
Posted By Yoda
Please note that -A option used to define...
Please note that -A option used to define associative arrays is available only on modern KSH version. The option -a is used to define indexed arrays.

From KSH manual:
-A Declares vname to be...
22,209
Posted By Don Cragun
Try changing: cat ${a[$j]} | sed -e...
Try changing:
cat ${a[$j]} | sed -e 's/\([[:punct:]]\)//g' > revised.txtto:
sed -e 's/#/^g/g;s/\([[:punct:]]\)//g;s/^g/#/g' "${a[$j]}" > revised.txtwhere the ^g in both cases is a control character...
1,353
Posted By Yoda
If you have GNU grep: grep -o "unix" file | wc...
If you have GNU grep:
grep -o "unix" file | wc -l

---------- Post updated at 13:50 ---------- Previous update was at 13:43 ----------

@joeyg, I noticed a typo, also wc -l can be replaced with...
2,098
Posted By Scrutinizer
In bash4 you can do this: mapfile -ts1 array <...
In bash4 you can do this:
mapfile -ts1 array < infile

$ echo "${array[0]}"
Bob :Instructor :30,000
1,158
Posted By methyl
An if this is actually "ksh", the "==" is...
An if this is actually "ksh", the "==" is invalid: Anyway we always put quotes round a string comparison.

if [ "$(hostname)" = "abc_test" ]
then
BASE=/home/fmtest; export BASE
else
...
2,818
Posted By agama
Only one sed is really necessary: sed...
Only one sed is really necessary:


sed 's/mars.*//; T; q;' input-file


If a substitution isn't made the T command causes the rest of the script to be skipped. When a substitution is made, the...
2,251
Posted By methyl
A unix way with "tr": Assumes columns 1 and 4...
A unix way with "tr": Assumes columns 1 and 4 are always numbers and columns 2,3 and 5 are always lower-case letters.
cat input.txt | tr '[abcdefghijklmnopqrstuvwxyz]'...
Showing results 1 to 25 of 52

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