Slurm incorrectly padding unicode - slurm

When submitting jobs with sbatch, I often like to put unicode characters in my job names. However, when this happens, it seems like sbatch things each unicode character is two characters long, even though in my Terminal it's displayed as one character. This causes the formatting to look strange:
Is there any way to make the character padding work better (without having to put the job name at the end of the line)? This is the squeue command that causes the issue:
squeue --user $USER --format '%10j %18i ...'

You can use the column command with the -t argument that will take care of unicode character alignment and make column widths dynamic:
$ squeue --me --format "%30j %18i"
NAME JOBID
xxxxxxxxxxxxxx 10797040
P6 10797007
δ0.2_λ0.25 10797003
$ squeue --me --format "%30j %18i" | column -t
NAME JOBID
xxxxxxxxxxxxxx 10797040
P6 10797007
δ0.2_λ0.25 10797003

Related

cut choice parameter value in executable shell script of jenkins

I have a choice parameter in Jenkins FreeStyle Job Type.
Choices Are for Variable ${IP}:
192.168.1.33-prod
192.168.1.34-qa
192.168.1.35-stage
In The Executable Shell Script,I want to remove the the value after "-" in the selected choice parameter, before the value is assigned to the command.
The Command Executed:
rsync --owner=ec2-user --group=ec2-user -O --no-p -arzh --exclude ".git/" --perms --chmod=a+rwx /tmp/some-value/ ec2-user#${IP}:/some-folder/
The Linux Command is:
echo ${IP} | cut -f1 -d"-"
The Result Should be
Result:
192.168.1.33
The Final Command before execution should look like:
However, the value is coming empty when i try the below way:
rsync --owner=ec2-user --group=ec2-user -O --no-p -arzh --exclude ".git/" --perms --chmod=a+rwx $WORKSPACE/ ec2-user#192.168.1.33:/some-folder/
The problem is probably related to the step where you re-assign the value of the IP variable -- that step is missing in your question.
However, in your case it could be more elegant to use shell parameter expansion instead of cut. With %%, you can remove the longest matching pattern at substitution time, so this should do the trick:
rsync [...] ec2-user#${IP%%-*}:/some-folder/
For details, see the bourne shell manual page.

Use bash variable in substitution command with this formatting, with JSON

I have a bash script where one of the part in a command changes from time to time.
So I tried to change the script, so we could ask for it, or change at one part only, etc., but can't really make it.
If I write this, it works:
#!/bin/bash
changing_stuff='"Active-2021-xy Part YX"'
total_number=`Command_xy show base name "Active-2021-xy-yz Part YX" limit 1 --format json | jq '.total'`
I've used '" "' because as you see in the original command it requires " " for that part.
How could I add the changing_stuff into the middle of the script?
Thanks a lot!
The following should work. There's no need to add quotes into your changing_stuff variable. Putting quotes around the variable when you use it causes the whole value (including the spaces) to be passed as a single argument to Command_xy.
#!/bin/bash
changing_stuff='Active-2021-xy Part YX'
total_number=`Command_xy show base name "$changing_stuff" limit 1 --format json | jq '.total'`
You seem to be looking for the trivial
#!/bin/bash
changing_stuff='Active-2021-xy Part YX'
total_number=`Command_xy show base name "$changing_stuff" limit 1 --format json | jq '.total'`
The quotes are simply a mechanism for keeping the string with spaces in it as a single argument, in both places.
(Tangentially, you also want to replace the backticks with modern command substitution syntax:)
#!/bin/bash
changing_stuff='Active-2021-xy Part YX'
total_number=$(Command_xy show base name "$changing_stuff" limit 1 --format json | jq '.total')

Why ip_forward_use_pmtu added in the result of sysctl in linux server

So I did an OS version-up in a linux server, and was seeing if any setting has been changed.
And when I typed "sysctl -a | grep "net.ipv4.ip_forward"
The following line was added,
net.ipv4.ip_forward_use_pmtu = 0
I know that this is because this parameter is in /proc/sys.
But I think if the result of sysctl before upload did not show this line, it was not in /proc/sys before as well, right ?
I know that 0 means " this setting is not applied...So basically it does not do anything.
But why this line is added.
The question is
Is there any possible reason that can add this line?
Thank you, ahead.
Even the question itself "added in the result of sysctl in linux server" is wrong here.
sysctl in the way you invoked it, lists all the entries.
grep which you used to filter those entries "selects" matching texts, if you'd run grep foo against the list:
foo
foobar
both items would be matched. That's exactly what you see but the only difference is instead of "foo" you have "net.ipv4.ip_forward".
Using --color shows that clearly:
Pay attention to the use of fgrep instead of grep because people tend to forget that grep interprets some characters as regular expressions, and the dot . means any character, which might also lead to unexpected matches.

removing {^D ctrl+d } junk from a file using shell

I'm using a shell & TCL script to login to a switch and get the output of certain commands and in some places I can see ^D coming up. I tried to use the dos2unix utility but still it didn't go away.
Eth1/37 NOM: xcvrAbsen routed auto auto --
^DEth1/38 NOM: xcvrAbsen routed auto auto --
Eth1/39 NOM: xcvrAbsen routed auto auto --
Eth101/1/45 eth 1000 NOM:NO_PATCHING CABLE
^DEth101/1/46 eth 1000 NOM:NO_PATCHING CABLE
Eth101/1/47 eth 1000 NOM:NO_PATCHING CABLE
How can this be eliminated, are there any standard tools like dos2unix which can get rid of such data?
What I'm trying to do is to compare two files which are from the same switch and the same command and the same output, but due to these ^D, Vimdiff shows it as different lines.
How to get this eliminated?
Command I'm using is something like this:
$cdir/ciscocmd -Y -u $operator -p $password -s $password -t $switch -r rfc_sa_commands | sed 's/^^D//' > $switch.$NOW
dos2unix removes carriage returns, no other control characters.
The tool to remove all occurrences of an arbitrary character is called tr.
tr -d '\004' <inputfile >outputfile
This assumes you have literal ctrl-D characters, not sequences of caret ^ and D. The tr utility cannot remove a specific sequence; it just processes individual characters. To remove a sequence, you'd need
sed 's/\^D//g' inputfile >outputfile
where the backslash is required because the caret alone has a special meaning in regular expressions (it matches beginning of line). Doubling it does not escape it; ^^ probably still just matches beginning of line, though it's not really well-defined, and could introduce apparently random behavior.
Even if the special character is visible as '^D', it may be NOT catchable like this.
Interesting readings, are:
https://en.wikipedia.org/wiki/ASCII#Character_groups
https://en.wikipedia.org/wiki/End-of-Transmission_character
I think a way to do it would be:
<your command>|sed -e 's/\x04//g'
Does it solve your issue?

"Top" output is truncated when redirect to file ?

My project requires "Top" out to be redirect in a file.
I am running couple of application. When I tun top on telnet I am getting full path of one of my application. It looks like as follows
2079 1952 root R 12296 2% 0% -s=1 -PrjPath="/usr/local/Myproject/Application" -stgMode=1
But when I use following command to redirect the out put to file it gets truncated.
Command:
tope -b -n1
Out put:
2079 1952 root R 12296 2% 0% -s=1 -PrjPath="/usr/local/Myproject/Appl
Can any one tell me why it is truncated ?
How to get it full.
Following is my environment.
Embedded linux kernel v2.6.29.
busyboxy v1.10.4
"top" command is part of busybox.
Thanks in Advance
Bhargav Vyas
Use can use "-c" parameter to display the complete command, and you need to make sure the screen width is wide enough to display it.
Ex:
COLUMNS=512 top -b -n1 -c
One side effect would be, the complete path of the command will be displayed. This cannot be avoided. You should also consider using ps, which is much more customizable.
To display only the command names:
ps -eo pcpu,pid,user,comm | sort -k 1 -r
To display with arguments and path:
ps -eo pcpu,pid,user,args | sort -k 1 -r
and so on.
I had a truncating issue even after using the
-c :Command-line/Program-name toggle
option in batch mode. So I had to specify the output width with -w, like
top -b -n 1 -c -w 200
for example.
From the man page:
-w :Output-width-override as: -w [ number ]
In Batch mode, when used without an argument top will format output
using the COLUMNS= and LINES= environment variables, if set.
Otherwise, width will be fixed at the maximum 512 columns. With an
argument, output width can be decreased or increased (up to 512) but
the number of rows is considered unlimited.
In normal display mode, when used without an argument top will attempt
to format output using the COLUMNS= and LINES= environment variables,
if set. With an argument, output width can only be decreased, not
increased. Whether using environment variables or an argument with
-w, when not in Batch mode actual terminal dimensions can never be exceeded.
Note: Without the use of this command-line option, output width is
always based on the terminal at which top was invoked whether or not
in Batch mode.

Resources