Search Results

Search: Posts Made By: Scrutinizer
152
Posted By Scrutinizer
@ravinder, yes POSIX sort does not have a -s...
@ravinder, yes POSIX sort does not have a -s option, see:
sort (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html)

but GNU sort and BSD sort do.
152
Posted By Scrutinizer
@Ravinder nice different approach, in case the...
@Ravinder nice different approach, in case the sort utility understands stable sort.
152
Posted By Scrutinizer
Hi ksitij, I was in the process of adding an...
Hi ksitij, I was in the process of adding an explanation, it has been added to my post...
152
Posted By Scrutinizer
Hi, try: awk '/^[0-9]/{print x}1' file | ...
Hi, try:

awk '/^[0-9]/{print x}1' file |
awk '{$1=$1}1' RS= FS='\n' OFS=§ |
sort -rnk 5,5 |
tr § '\n'


Split the records with a blank line, using a digit on the first position as the...
116
Posted By Scrutinizer
This command (if you are using GNU sed): sed...
This command (if you are using GNU sed):
sed 's/^1\|[0-9]*\_STATUS/STATUS/' outputOFF_00280456_2014_TEST.txt
Means replace either :
The digit "1" on a line that starts with that digit OR
zero or...
326
Posted By Scrutinizer
Ah so it is the other way around? The hostname is...
Ah so it is the other way around? The hostname is always lowercase, but the path may be uppercase?

Try something like:
cd $(ls -d "$(hostname)"* "$(hostname | tr '[[:lower:]]' '[[:upper:]]')"*...
307
Posted By Scrutinizer
Hi, try: awk 'NR==FNR{A[$1]=$2; next} {print...
Hi, try:
awk 'NR==FNR{A[$1]=$2; next} {print $1, $1 in A? A[$1]:0}' file2 file1
326
Posted By Scrutinizer
Instead of hostname you could try: hostname|tr...
Instead of hostname you could try:
hostname|tr '[[:upper:]]' '[[:lower:]]'
158
Posted By Scrutinizer
You are using two stdin feeds to the while loop: ...
You are using two stdin feeds to the while loop:
sed 1d $file_name |
and
<$file_name
If you leave the latter it should skip the first line because of the sed statement...
340
Posted By Scrutinizer
Can it occur only once per sequence? If not what...
Can it occur only once per sequence? If not what should happen with multiple matches per sequence?
395
Posted By Scrutinizer
In for some golf :) ? awk '{$1=A[i=$1];...
In for some golf :) ?
awk '{$1=A[i=$1]; A[i]=$0} END{for(i in A) print i A[i]}' FS="\t" OFS="\t" A.txt
Forum: What is on Your Mind? 1 Week Ago
467
Posted By Scrutinizer
Hey Simon, welcome to the team. I have enjoyed...
Hey Simon, welcome to the team. I have enjoyed your high quality contributions. Well deserved!
387
Posted By Scrutinizer
Try: awk '$2=="Total Sequences"{n=-3}...
Try:
awk '$2=="Total Sequences"{n=-3} ++n==0{print "$ts=" $2}' RS=\< FS=\> file
Forum: Shell Programming and Scripting 2 Weeks Ago
923
Posted By Scrutinizer
Indeed, that would only work if the files had...
Indeed, that would only work if the files had already been deflated so that was not very helpful :)

Try this instead:
find . -name '*.jar' -exec bash -c '\
result=$(zipgrep -HIli...
Forum: Shell Programming and Scripting 2 Weeks Ago
923
Posted By Scrutinizer
Try: find . -name '*.jar' -exec jar tf {} \; |...
Try:
find . -name '*.jar' -exec jar tf {} \; | grep -v '/$' | xargs grep -hil 'org/openqa/selenium/WebDriver'
576
Posted By Scrutinizer
If you are using for i in "${binaryValues[@]}";...
If you are using for i in "${binaryValues[@]}"; then i will contain the value, not the array index in every iteration
-ge is incorrect syntax within (( ... )) , that should be >=
$"((...))" is...
Forum: Shell Programming and Scripting 2 Weeks Ago
923
Posted By Scrutinizer
jar tvf can only take one archive as parameter,...
jar tvf can only take one archive as parameter, so try:
find . -name '*.jar' | xargs -n 1 jar tvf
This will break if there are spaces in directory or file names

You could also try:
find ....
Forum: Shell Programming and Scripting 2 Weeks Ago
694
Posted By Scrutinizer
You are welcome Cacializ. GNU sed -i has a backup...
You are welcome Cacializ. GNU sed -i has a backup option:
-i[SUFFIX], --in-place[=SUFFIX]
The BSD sed man page says you should always use it. Anyway in general it is always a good idea to have...
Forum: Shell Programming and Scripting 2 Weeks Ago
694
Posted By Scrutinizer
Hi, with sed you can try: sed...
Hi, with sed you can try:
sed 's|<td>\([0-9]\{1,\}\)</td>|<td><button onclick="reset(\1)">Reset</button>\1</td>|' file
You can add the leading tabs if you need them, but in the sample there were...
92
Posted By Scrutinizer
Hi try: sed 's/\<0\.0\.0\.0\>/ALL/g' file ...
Hi try:

sed 's/\<0\.0\.0\.0\>/ALL/g' file


The \< and \> characters mark word boundaries which are a GNU regex extension. Since you appear to be on a Linux system that has GNU sed, this should...
600
Posted By Scrutinizer
Some more suggestions: Can the server ssh...
Some more suggestions:

Can the server ssh or mail out for example?
Does it have software configuration management, like puppet, chef, ansible, you could use that...
Splunk maybe?
monit, or...
527
Posted By Scrutinizer
It is indeed difficult to give a complete answer...
It is indeed difficult to give a complete answer for all corner cases, however, for simple cases, you could try how far something like:
perl -p0777e 's#/\*.*?\*/|\*.*?\;##sg' file
would get you....
859
Posted By Scrutinizer
What is your OS and version?
What is your OS and version?
647
Posted By Scrutinizer
The sort options mean the following, -t/ : ...
The sort options mean the following,
-t/ : split fields on the / character
-k2,3r : First, reverse (r) sort on the string that consists of fields 2 to 3 , which is root/path[12] in the example...
647
Posted By Scrutinizer
Hi, try: sort -t/ -k2,3r -k1,1rn -k4 file ...
Hi, try:
sort -t/ -k2,3r -k1,1rn -k4 file

120 /root/path2/part-00000-d3700305-428d-4b13-8161-42051f4ac5ed-c000.json
72 /root/path2/BishnuPrasadRout[5_0].doc
4 /root/path2/hello.c...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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