Unix/Linux Go Back    

Showing results 1 to 25 of 500
Search took 0.29 seconds.
Search: Posts Made By: RudiC
Forum: Shell Programming and Scripting Linux 1 Day Ago
Replies: 7
Views: 362
Posted By RudiC
Not with the sed and file versions that I have: ...

Not with the sed and file versions that I have:
sed 's/^file \| conflict.*$//g' file
/usr/share/icons/Papirus/16x16/actions/papirus-icon-theme-20180501-1.noarch...
Forum: Shell Programming and Scripting Linux 1 Day Ago
Replies: 7
Views: 362
Posted By RudiC
Brilliant! Yes, it will do as long as there are...

Brilliant!
Yes, it will do as long as there are NO SPACES in the file names.
And, the file name is considered a single column as long as it doesn't have field separators in it, i.e. you don't...
Forum: UNIX for Beginners Questions & Answers Linux 2 Days Ago
Replies: 7
Views: 250
Posted By RudiC
Yes, this is a feature of awk: if the variable...

Yes, this is a feature of awk: if the variable has an integer value, it uses %d, not the defined default format... Try
awk '{$10+=1e-9; $11+=1e-9; $12+=1e-9}1' CONVFMT="%.2e" file
Forum: UNIX for Beginners Questions & Answers Linux 2 Days Ago
Replies: 7
Views: 250
Posted By RudiC
Try also awk '{$10+=0; $11+=0; $12+=0}1'...

Try also
awk '{$10+=0; $11+=0; $12+=0}1' CONVFMT="%.2e" file


And, you can't modify the file in place (even the editors that claim doing so work on temporary file overwriting the original with...
Forum: UNIX for Beginners Questions & Answers Linux 3 Weeks Ago
Replies: 5
Views: 267
Posted By RudiC
Why the need at all to run bash from .profile?...

Why the need at all to run bash from .profile? What's your login shell? Could you ask your sys admin to change your login shell to bash.
Forum: Shell Programming and Scripting Linux 3 Days Ago
Replies: 2
Views: 241
Posted By RudiC
Try awk -vKEYARR="w m l" ' BEGIN {for...

Try
awk -vKEYARR="w m l" '
BEGIN {for (n=split (KEYARR, TMP); n; n--) KEYS[TMP[n]]
}
{RES = 1
for (i=1; i<=NF; i++) if ($i in KEYS) RES*=$(i+1)
print RES
...
Forum: UNIX for Beginners Questions & Answers Linux 4 Days Ago
Replies: 8
Views: 200
Posted By RudiC
@vgersh99: although I really love this creative...

@vgersh99: although I really love this creative approach, I'm afraid there's a leading $ sign missing in the "command substitution"?
Forum: UNIX for Beginners Questions & Answers Linux 4 Days Ago
Replies: 8
Views: 200
Posted By RudiC
Welcome to the forum. Depending on your...

Welcome to the forum.


Depending on your bash version, there are different options:
- shopt -s lastpipe; set +m

- read N L <<< $(grdinfo data.grd | awk '{print $10,$5}')


- read N L...
Forum: Shell Programming and Scripting Linux 4 Days Ago
Replies: 3
Views: 211
Posted By RudiC
Or: awk '/;$/' fileorsed '/;$/!d' file

Or:
awk '/;$/' fileorsed '/;$/!d' file
Forum: Shell Programming and Scripting Linux 5 Days Ago
Replies: 3
Views: 176
Posted By RudiC
How about awk -F: ' {gsub...

How about
awk -F: '
{gsub (/[\\",]/, _)
}
/^ *_id/ {ID = $2
}
/^ *pubmed/ {PM[++CUR] = $2
}
/^ *text/ {TX[CUR]...
Forum: Shell Programming and Scripting Linux 6 Days Ago
Replies: 9
Views: 306
Posted By RudiC
Howsoever, how far would awk ' function...

Howsoever, how far would
awk '
function RMDUP(P1, T, TX, DL) {for (n = split (P1, TMP, ","); n; n--) T[TMP[n]]
for (t in T) {TX = TX DL t
...
Forum: Linux Linux 1 Week Ago
Replies: 7
Views: 377
Posted By RudiC
No need to become mocking and thus violate forum...

No need to become mocking and thus violate forum rules. Bakunin certainly was not the only one to stumble over your initial post and rightly asked for a better specification. From then on, the...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 4
Views: 211
Posted By RudiC
You weren't too far off. Try FS="[;=]".

You weren't too far off. Try FS="[;=]".
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 8
Views: 341
Posted By RudiC
As the sample doesn't contain the "WrongValue"...

As the sample doesn't contain the "WrongValue" string, you don't seem to want that condition tested.

Would this come close to what you need?
printf '%s\n' "${RawContent}" |
awk '
/## ...
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 7
Views: 344
Posted By RudiC
Try awk -F"[|,]" ' NR == 1 {for...

Try
awk -F"[|,]" '
NR == 1 {for (n=split (TGTSTR, T); n; n--) TGT[T[n]]
}
{for (i=2; i<=NF; i++) for (t in TGT) if ($i ~ t) TMP = TMP (TMP?",":"") $i
...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 8
Views: 341
Posted By RudiC
Do you really want people in here to build their...

Do you really want people in here to build their own test cases from the sparse info that you provided? Or do you want untested proposals that might or might not work?
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 3
Views: 223
Posted By RudiC
Using shell's "Parameter Expansion" (here:"Remove...

Using shell's "Parameter Expansion" (here:"Remove matching suffix pattern") doesn't allow you to do multiple operations in one command, you always need to use an interim variable.
You could, on...
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 6
Views: 191
Posted By RudiC
I'm not at home on solaris; does this help: ...

I'm not at home on solaris; does this help:

sed '1 {x; d; n; }; G; s/\
/ /;' file2 file1
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 6
Views: 191
Posted By RudiC
That's not how it works. It prints the line incl....

That's not how it works. It prints the line incl. a <new line> char, and then reads and prints the text, regardless of the $ regex.
How about
sed '1 {x; d; n}; G; s/\n/ / ' file2 file1
This is a...
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 3
Views: 211
Posted By RudiC
Welcome to the forum. How about rev file |...

Welcome to the forum.

How about
rev file | column -t | rev
1 2 345678 90
2 2 356 42
3 3 8265 55
Be aware that this will right justify every column.
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 8
Views: 358
Posted By RudiC
I forgot to mention: increasing dd's block size...

I forgot to mention: increasing dd's block size to several MB will speed up the copy process dramatically, but don't go too high. And, I think the TMP file is not necessary, you can use the output...
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 3
Views: 208
Posted By RudiC
While rdrtx1's proposal is based on the...

While rdrtx1's proposal is based on the assumption that records are related by $1 key value, this one goes for the line No.:
awk '
NR == 1 {for (i=1; i<=NF; i++) if ($i == COL) TGF = i
...
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 7
Views: 286
Posted By RudiC
Try awk -F\| -vOFS=\| ' NR==1 {sub...

Try
awk -F\| -vOFS=\| '
NR==1 {sub ("\\"FS $5 "\\"FS $6 "\\"FS, FS)
print
next
}
$5 == "INV" {if (MIN[$1] > $6 || MIN[$1] == "")...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 3
Views: 265
Posted By RudiC
Did you consider writing a wrapper script around...

Did you consider writing a wrapper script around the software?
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 14
Views: 599
Posted By RudiC
Enclose the $line in double quote to have the...

Enclose the $line in double quote to have the shell preserve spaces within.

But, I may be thick-witted, but the entire problem escapes me, even with the new sample.
OK, you have the OS - however...
Showing results 1 to 25 of 500

 


All times are GMT -4. The time now is 04:39 AM.