Search Results

Search: Posts Made By: ahamed101
1,603
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 |...
870
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
4,990
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
6,384
Posted By MadeInGermany
vim -n file does not use a swap file.
vim -n file
does not use a swap file.
3,521
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
1,385
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...
5,387
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...
1,503
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...
4,184
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...
2,653
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...
4,810
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...
1,377
Posted By drl
Hi. $ echo 123456789 | fold -w 3 123 456 ...
Hi.
$ echo 123456789 | fold -w 3
123
456
789
Best wishes ... cheers, drl
1,543
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)
1,543
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...
3,394
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\';...
1,590
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...
2,158
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
1,580
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...
1,937
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...
16,827
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...
759
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...
1,559
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
802
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,146
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...
1,543
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

 

Featured Tech Videos

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