Unix/Linux Go Back    

Showing results 1 to 25 of 500
Search took 0.11 seconds.
Search: Posts Made By: Scrutinizer
Forum: Shell Programming and Scripting Linux 9 Hours Ago
Replies: 5
Views: 114
Posted By Scrutinizer
With bash3 or up, zsh and a recent ksh93, you can...

With bash3 or up, zsh and a recent ksh93, you can also use pipefail:
$ set -o pipefail; false | true ; echo "$?"
1

On Solaris 10, what shells/versions do you have available?
Forum: Shell Programming and Scripting Linux 1 Day Ago
Replies: 7
Views: 222
Posted By Scrutinizer
When I copy and paste your samples into a file it...

When I copy and paste your samples into a file it works fine. When I remove one of the lines of input.txt, the corresponding line in file.txt gets printed. Could you try that yourself?

Also, make...
Forum: UNIX for Beginners Questions & Answers Linux 1 Day Ago
Replies: 4
Views: 110
Posted By Scrutinizer
Hi, try: awk -F, '$1~96656' STG3TOUDCMATCH >>...

Hi, try:
awk -F, '$1~96656' STG3TOUDCMATCH >> 56_Ser
Forum: UNIX for Beginners Questions & Answers Linux 2 Days Ago
Replies: 9
Views: 226
Posted By Scrutinizer
@abhilashnair, could you answer the Don Cragun's...

@abhilashnair, could you answer the Don Cragun's questions in post #2. Then we could likely provide you with a better answer.
Forum: Shell Programming and Scripting Linux 3 Days Ago
Replies: 8
Views: 240
Posted By Scrutinizer
Hi, try: (!($4 in CHR)) rather than (! $4 in...

Hi, try:
(!($4 in CHR)) rather than (! $4 in CHR)
Forum: UNIX for Advanced & Expert Users Linux 4 Days Ago
Replies: 2
Views: 148
Posted By Scrutinizer
Like this ? rpm -qi some_package | grep...

Like this ?
rpm -qi some_package | grep ^Install


---
or, for multiple packages at once, try:
pkgs=( package1 package2 package 3 )
rpm -qi "${pkgs[@]}" | grep -E '^(Name|Install)' | paste - -
Forum: Shell Programming and Scripting Linux 4 Days Ago
Replies: 9
Views: 274
Posted By Scrutinizer
Just for fun, another one: sed 's/../& /g' file...

Just for fun, another one:
sed 's/../& /g' file | xargs -n 3
Forum: Shell Programming and Scripting Linux 5 Days Ago
Replies: 16
Views: 346
Posted By Scrutinizer
@jim: but the red curly brace (the second closing...

@jim: but the red curly brace (the second closing brace) should be there, no?
It is present in the code in both post #1 and post #3 ...
Forum: Shell Programming and Scripting Linux 6 Days Ago
Replies: 12
Views: 321
Posted By Scrutinizer
I think it may be an UTF-16 character. What...

I think it may be an UTF-16 character.

What is the output of the following command on your command line:
locale
Forum: Shell Programming and Scripting Linux 6 Days Ago
Replies: 16
Views: 346
Posted By Scrutinizer
On the two but last line: done<( .... try: ...

On the two but last line:
done<( ....
try:
done < <( ...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 2
Views: 178
Posted By Scrutinizer
Also, you cannot use elif without a preceding if...

Also, you cannot use elif without a preceding if statement. Presumably you meant if, rather than elif ?

Plus: echo "$NOW $process service has been started" will always give exit status 0 so you...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 10
Views: 206
Posted By Scrutinizer
Hi, try: awk '{for(i=1; i<=NF; i++)...

Hi, try:
awk '{for(i=1; i<=NF; i++) {gsub(/^"|"$/,"^",$i); gsub(/"/,"§",$i)}}1' FS=\~ OFS=\~ file
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 4
Views: 175
Posted By Scrutinizer
If the files are always grouped and in...

If the files are always grouped and in sorted/increasing order per group, then something like this might suffice:
awk '{i=$1 FS $5; if(i!=p) {if(p) print p,l,h; l=$2; p=i} h=$3} END{print p,l,h}'...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 1
Views: 154
Posted By Scrutinizer
Everyone at the UNIX and Linux Forums gives their...

Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 2
Views: 154
Posted By Scrutinizer
Try: var=$( cat << "EOF"...

Try:
var=$(
cat << "EOF"...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 5
Views: 216
Posted By Scrutinizer
Try: awk ' NR==FNR { if(FNR==2) ...

Try:

awk '
NR==FNR {
if(FNR==2)
ligval=$1
if(FNR>2 && NF>3)
lig=lig $0 RS
next
}
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 2
Views: 180
Posted By Scrutinizer
Try something like this: awk -F'[ ,]'...

Try something like this:
awk -F'[ ,]' 'NR==FNR{A[$1]=$0; next} $2 in A{print $0, A[$2]}' file2 file1
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 10
Views: 247
Posted By Scrutinizer
Another approach: awk -F, '{gsub(/[^,]*: /,x);...

Another approach:
awk -F, '{gsub(/[^,]*: /,x); $1=$1}1' file

--
or
sed 's/[^,]*: //g; s/,/ /g' file
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 3
Views: 195
Posted By Scrutinizer
Have you tried: prefix=${fname%%_*} ?

Have you tried:
prefix=${fname%%_*}
?
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 2
Views: 196
Posted By Scrutinizer
Try: echo...

Try:
echo "'/var/FTPROOT/px/sci/archive/20171102070057904-DY_DC04_Daily Inventory Sync-en-us.csv' '/var/FTPROOT/px/sci/archive/20171102070058291-DY_DC07_Daily Inventory Sync-en-us.csv'" |
awk...
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 3
Views: 230
Posted By Scrutinizer
@OP: The -n option means that you do not print...

@OP: The -n option means that you do not print anything unless specified with the p command. You should leave it out.

The quotes and the minus signs in your example are not the right characters:...
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 3
Views: 234
Posted By Scrutinizer
Another variation: for i in *.test; do read...

Another variation:
for i in *.test; do
read new || break
mv "$i" "${i%%-*}-${new}.${i##*.}"
done <names.txt
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 19
Views: 401
Posted By Scrutinizer
That may be caused by a file in Windows format....

That may be caused by a file in Windows format. Convert it to Unix-style first:

tr -d '\r' <dtd.dat >dtd.unix.dat
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 19
Views: 401
Posted By Scrutinizer
A slightly different way that should work with...

A slightly different way that should work with all versions of (n)awk :
awk '{$12=$12}1' FS=\~ OFS=\~ file




--
or, more general:
awk -v n=12 '{$n=$n}1' FS=\~ OFS=\~ file
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 5
Views: 284
Posted By Scrutinizer
Hi Scott, yes what I meant is when you use printf...

Hi Scott, yes what I meant is when you use printf in the safe/usual way (without data in the format argument):
printf '"%s"\n' "$1"
Showing results 1 to 25 of 500

 


All times are GMT -4. The time now is 07:58 PM.