Search Results

Search: Posts Made By: JSKOBS
3,725
Posted By wisecracker
Hi JSKOBS... Not quite exactly what you are...
Hi JSKOBS...

Not quite exactly what you are looking for but a little bit of lateral thinking creates this.
#!/bin/sh
# awk_shell.sh

: > /tmp/myfunc
chmod 755 /tmp/myfunc

cat << "EOF" >...
976
Posted By vgersh99
How about: $ echo ' ...
How about:
$ echo ' <APPLICATION="APPLSG" SUB_APPLICATION="DLY" JOBNAME="DPL_BN_RE_CCMS_SA" CMDLINE="run_job.ksh %%PARAM1 %%PARAM2" TASKTYPE="Command" />' | awk -F'"' '{for(i=2;i<NF-2;i=i+2)...
867
Posted By RudiC
How aboutawk 'awk ' NR == 1 {printf...
How aboutawk 'awk '
NR == 1 {printf "%-40s%-23s%-23s\n", "Job name", "Created on", "Modified on"
}
/^Job name/ {printf "%-40s", $3
}
/^Created on/ ...
816
Posted By RudiC
So? Why don't you insert it into the proposal?
So? Why don't you insert it into the proposal?
816
Posted By RudiC
Would this come near of what you need: echo -e...
Would this come near of what you need:
echo -e "MMS000101S0203430A|20180412E|\nMMB0001INVESTMENT||107-86193-01-03|\nMMB0001FUND||107-86193-04-01|\nMMC9991 " |
awk -F'|' -v OFS=, '
/^MMC9991/ ...
727
Posted By RudiC
Try also awk -F, '{T[$1] = T[$1] ORS $2} END...
Try also
awk -F, '{T[$1] = T[$1] ORS $2} END {for (t in T) if (!(T[t] ~ t)) print substr(T[t],2)}' file
B2
C2
727
Posted By rdrtx1
awk -F, '{a[$0]=$0} $1==$2 {b[$1]=$2} END {for (i...
awk -F, '{a[$0]=$0} $1==$2 {b[$1]=$2} END {for (i in a) {$0=a[i]; if (!($1 in b)) print $2}}' file
4,984
Posted By RavinderSingh13
Hello JSKBOS, Following may also help you on...
Hello JSKBOS,

Following may also help you on same.

awk '{printf("%s%s\n",FNR==1?"START OF LINE":"",$0)' Input_file
Thanks,
R. Singh
4,984
Posted By bakunin
RudiC already told you how to do it but you might...
RudiC already told you how to do it but you might profit from understanding why your code did not work:

The reason why this doesn't work is that "NR" is only updated when records are read....
4,984
Posted By RudiC
Why not awk 'NR == 1 {print "START OF LINE"}...
Why not
awk 'NR == 1 {print "START OF LINE"} 1' file?

EDIT: or
[ -s "$FILE" ] && { echo "START OF LINE"; cat "$FILE"; }
859
Posted By MadeInGermany
Another idea, very efficient, is to exit after...
Another idea, very efficient, is to exit after the print.
awk -F"=" '/\$Temp/ {print $2; exit}' /DIRECTORY/*
5,131
Posted By Don Cragun
Hi RudiC, When JSKOBS said ""decimal" have two...
Hi RudiC,
When JSKOBS said ""decimal" have two decimal points", I think the requirement was a single radix character and two decimal digits following it. There was also a requirement for zero or...
5,131
Posted By RudiC
How about awk -F\| ' {if (!sub...
How about
awk -F\| '
{if (!sub (/^[0-9][0-9] [A-Z][A-Z][A-Z]/, "&|", $2)) $2 = FS $2
if (!sub (/[0-9.]*[0-9][A-Z]* *$/, "|&", $2)) $2 = $2 FS
}
1
' OFS="|" file
953
Posted By itkamaraj
If is not loop. Its conditional statement. I...
If is not loop. Its conditional statement.

I guess, APPEND is having string.

please try this

#!/bin/bash

echo -n "Enter the String : "
read APPEND
LENGTH=${#APPEND}
if [[ -z...
10,449
Posted By apmcd47
Could you use pgrep? ps -l -p$(pgrep -d,...
Could you use pgrep?

ps -l -p$(pgrep -d, process_name)

will list all processes named "process_name"
You want sub-processes of "process_name"?

ps -l --ppid $(pgrep -d, process_name)

And...
10,449
Posted By MadeInGermany
ps -ef displays args, so try ps -eo...
ps -ef displays args, so try
ps -eo etime,pid,args | grep "[d]sjob.*run"
The [ ] trick prevents from matching the grep process argument.
10,449
Posted By jim mcnamara
None, except output formatting From the linux...
None, except output formatting
From the linux man page for ps(1)


To see every process on the system using standard syntax:
ps -e
ps -ef
ps -eF
...
2,262
Posted By RudiC
Happy with the result? Looking back at it, it...
Happy with the result?
Looking back at it, it could be slightly simplified:
awk '{T = substr ($0,1,7) ; gsub("[[:alpha:]]","X"); print T substr ($0, 8)}' file
2,262
Posted By RavinderSingh13
Hello JSKOBS, Could you please try...
Hello JSKOBS,

Could you please try following and let me know if this helps you.

awk '{P=substr($0,1,7);num=split(substr($0,8), A,"");for(i=1;i<=num;i++){if(A[i] !~...
1,994
Posted By bakunin
To add a different take: if you mean by...
To add a different take: if you mean by "non-printable" characters those which cannot be displayed because of your locale (like, for instance, UTF-8-characters with a "C"-locale) you can use seds...
1,994
Posted By Don Cragun
You haven't really described what you consider...
You haven't really described what you consider non-printing characters. In most locales, RudiC's suggestion will select any lines that contain any character that is not <space> and is not in class...
1,994
Posted By RudiC
How about grep '[^[:print:]]' filename?
How about
grep '[^[:print:]]' filename?
2,137
Posted By Akshay Hegde
I think it shows total as well :)
I think it shows total as well :)
2,137
Posted By pilnet101
Another solution: printf "%s|%s\n" $(wc -l...
Another solution:

printf "%s|%s\n" $(wc -l file.txt asdf.txt lkjh.txt bvcx.txt|sed '$d') >> temp.txt
2,137
Posted By RavinderSingh13
Hello JSKOBS, If you want simple and sober...
Hello JSKOBS,

If you want simple and sober line counts the you could use wc command as follows.

wc -l Input_file1 Input_file2 Input_file3 Input_file4 | grep -v "total"
Output will be as...
Showing results 1 to 25 of 53

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