terminal

Bash command to calculate average on each row and each column

隐身守侯 提交于 2021-02-17 07:13:08
问题 Suppose we have a log file like marks.log and the content looks something like this: Fname Lname Net Algo Jack Miller 15 20 John Compton 12 20 Susan Wilson 13 19 I want to add a new column that contains average for each person, and a new row that contains average for each course. The result has to look like this: Fname Lname Net Algo Avg Jack Miller 15 20 17.5 John Compton 12 20 16 Susan Wilson 13 19 16 Average 13.3 19.6 - 回答1: If your data is in datafile.txt , the syntax for awk could be

Python pip installation on Mac is not working

拜拜、爱过 提交于 2021-02-17 06:26:31
问题 I have a Macbook Air and want to install pip. I have the updated python version. I follow all the instructions but I cannot install any packages. I have been researching for more than 1 hour and looking at many articles and questions but I cannot figure it out. This is what is displayed on my Terminal when I try to install pip, and then install a package called beautifulsoup: arnau@MacBook-Air-de-Arnau ~ % python --version Python 2.7.16 arnau@MacBook-Air-de-Arnau ~ % curl https://bootstrap

ZOC Terminal:text has been cut halfway down the page

限于喜欢 提交于 2021-02-17 06:16:05
问题 I work with ZOC terminal installed at windows 7 in order to communicate with device that has Linux operating system zoc picture. The communication via terminal works great but recently the text has been cut halfway down the page. attached picture . 回答1: The picture shows 24 lines. You can get this behavior if your terminal description sets scrolling margins to 24 lines — as some might do, when initializing the terminal if the application assumes that the screen has 24 lines. Since ZOC could

ZOC Terminal:text has been cut halfway down the page

左心房为你撑大大i 提交于 2021-02-17 06:16:05
问题 I work with ZOC terminal installed at windows 7 in order to communicate with device that has Linux operating system zoc picture. The communication via terminal works great but recently the text has been cut halfway down the page. attached picture . 回答1: The picture shows 24 lines. You can get this behavior if your terminal description sets scrolling margins to 24 lines — as some might do, when initializing the terminal if the application assumes that the screen has 24 lines. Since ZOC could

Why do my Bash prompt colors make cursor appear in wrong spot [duplicate]

 ̄綄美尐妖づ 提交于 2021-02-17 03:22:36
问题 This question already has an answer here : Adding ANSI color escape sequences to a bash prompt results in bad cursor position when recalling/editing commands (1 answer) Closed 4 years ago . I've got the following bash prompt: # helper function to set colors function ps1c() { tput setaf $1; } PS1='$(ps1c 243)\h $(ps1c 177)\W $(ps1c 214)$ \[\e[m\]'; When typing, sometimes my cursor returns to the left side of the screen and looks like it's overwriting the prompt. Also, when using the up arrow

Backspace(\b) not clearing text in Non-canonical mode termios

旧巷老猫 提交于 2021-02-17 02:17:29
问题 i am trying to clear text by pressing the backspace key, i am using termios in non canonical mode. i have created a conditional statement that when the users press backspace it should remove the previous character by going one character back. But when i press Backspace instead of removing the character it prints ^? on that line. I don't want to use canonical mode. My Code: #include <stdio.h> #include <stdlib.h> #include <termios.h> #include <unistd.h> #include <sys/types.h> #include <string.h

changing the output filenames in [split] [closed]

纵饮孤独 提交于 2021-02-16 16:40:09
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Improve this question I would like to split a huge text file into separate text files. I use: split -l 1000 file.txt split_file and I will get split_fileaa , split_filebb , etc. How can I change the extension to be split_file0.txt, split_file1.txt, etc ? 回答1: --additional-suffix is

How to preserve colors when capturing output from Git commands?

谁说胖子不能爱 提交于 2021-02-11 17:41:53
问题 I have a custom Git command implemented in Python that uses methods from the subprocess module to call git . I've noted that, depending on the method used, the output may or may not be colored, e.g.: import subprocess subprocess.run('git push origin --delete foobar', shell=True) print() print(subprocess.run('git push origin --delete foobar', shell=True, capture_output=True, encoding='utf-8').stderr, end='') Output: How to preserve colors in the captured output (both stdout and stderr)? 回答1:

How to preserve colors when capturing output from Git commands?

泪湿孤枕 提交于 2021-02-11 17:41:23
问题 I have a custom Git command implemented in Python that uses methods from the subprocess module to call git . I've noted that, depending on the method used, the output may or may not be colored, e.g.: import subprocess subprocess.run('git push origin --delete foobar', shell=True) print() print(subprocess.run('git push origin --delete foobar', shell=True, capture_output=True, encoding='utf-8').stderr, end='') Output: How to preserve colors in the captured output (both stdout and stderr)? 回答1:

from: cant read /varmail/ctypes when called

心已入冬 提交于 2021-02-11 15:45:19
问题 I am trying to implement some object detection in a project of mine using darknet.py. from my terminal I am able to run python3 darknet.py and get my results all fine. But when I have tried to include it in my own program I am getting several errors; from: cant read /var/mail/ctypes import im6.q16: not authorized math @error/constitute.c/writeimage/1037 I am not sure how to proceed. I have made sure darknet.py starts with #!/usr/bin/ env python3 as does my program, i am trying to run it with