Skip to main content

All Questions

Tagged with
0 votes
0 answers
17 views

How to returns the correct character after manipulating the output of ps ax | grep [duplicate]

I would like to have some help writing a script (which should works on freebsd where I have sh as default) that should grab a precise character when I do a "ps ax | grep" command from the ...
Marietto's user avatar
  • 579
1 vote
2 answers
73 views

Increment mountpoint name with awk

I am currently writing a script that makes mounting of LUKS devices easier. In the script I do have a default mountpoint name (data_1), - however, if a mountpoint like that already exists, I want to ...
Kyu96's user avatar
  • 183
1 vote
1 answer
612 views

Compare strings with different encodings

I'm trying to compare a string from a file that is encoded in UTF8 file /dev/eeprom: UTF-8 Unicode text, with very long lines with a serial number that is hardcoded into the script. When printing to ...
DK999's user avatar
  • 13
0 votes
1 answer
724 views

How to execute multiple commands from an input file and string it to a new output file

I want to execute multiple commands (one after the other) from an input.txt file and output it to a new .csv file. All the commands run successfully when executed individually, but nothing happens ...
gbi_gbi's user avatar
  • 11
0 votes
3 answers
64 views

How can a conditional statement be used in a piped command? [closed]

The data being processed will follow specific patterns. In this case I'd like to isolate all characters found in the third column and return any characters found after the "-" but only if that ...
dimmech's user avatar
  • 481
-1 votes
4 answers
920 views

how to cut float version numbers + linux

how to get only the two first digit from the following command my target is to get the hadoop basic version hdp-select | grep hadoop-client | awk '{print $NF}' 2.6.0.3-8 expected results: 2.6
yael's user avatar
  • 13.9k
12 votes
3 answers
7k views

How do you remove dot character from string without calling sed or awk again?

I have a file called hostlist.txt that contains text like this: host1.mydomain.com host2.mydomain.com anotherhost www.mydomain.com login.mydomain.com somehost host3.mydomain.com I have the following ...
Linoob's user avatar
  • 335
1 vote
1 answer
323 views

How can I access a column of a line from within a string?

I have a file I'm traversing in a for loop. I want to do something like... for line in file.out; do echo "Some text before $line($2) $line($3)"; done Where, for every line I insert the 2nd and 3rd ...
MrDuk's user avatar
  • 1,657
1 vote
2 answers
151 views

How do I stream edit progress-like output?

I'm having trouble editing some progress output. In this case it's Postgres' pg_basebackup, but it's similar to other progress output like curl and wget. Take for example the output of this: ...
Mark Peters's user avatar
3 votes
2 answers
6k views

Shell script to assign values from a lookup table is too slow

I'm trying to assign some variables from a lookup file with a shell script. I have something working but it seems unnecessary slow. Script: while read line do code=`...
David's user avatar
  • 33
70 votes
14 answers
64k views

Add thousands separator in a number

In python re.sub(r"(?<=.)(?=(?:...)+$)", ",", stroke ) To split a number by triplets, e.g.: echo 123456789 | python -c 'import sys;import re; print re.sub(r"(?<=.)(?=(?:...)+$)", ",", sys....
user2496's user avatar
  • 1,191