Linux/Ubuntu2025. 7. 11. 18:05

awk로 쇼할 바에는 이게 최고구만

[링크  https://packages.debian.org/search?keywords=csvtool]

 

+

2025.07.31

csv 파일에서 특정 셀을 뽑아내서 합계를 구하려는데

mlr과 csvtool을 gpt가 추천해줘서 찾아보게 됨

 

NAME
       csvtool - tool for performing manipulations on CSV files from shell
       scripts

SYNOPSIS
       csvtool [options] command [command-args] input.csv...

 

$ csvtool --help
csvtool - Copyright (C) 2005-2006 Richard W.M. Jones, Merjis Ltd.
        - Copyright (C) 2007- Richard W.M. Jones & Christophe Troestler

csvtool is a tool for performing manipulations on CSV files from shell scripts.

Summary:
  csvtool [-options] command [command-args] input.csv [input2.csv [...]]

Commands:
  col <column-spec>
    Return one or more columns from the CSV file.

    For <column-spec>, see below.

      Example: csvtool col 1-3,6 input.csv > output.csv

  namedcol <names>
    Assuming the first row of the CSV file is a list of column headings,
    this returned the column(s) with the named headings.

    <names> is a comma-separated list of names.

      Example: csvtool namedcol Account,Cost input.csv > output.csv

  width
    Print the maximum width of the CSV file (number of columns in the
    widest row).

  height
    Print the number of rows in the CSV file.

    For most CSV files this is equivalent to 'wc -l', but note that
    some CSV files can contain a row which breaks over two (or more)
    lines.

  setcolumns cols
    Set the number of columns to cols (this also makes the CSV file
    square).  Any short rows are padding with blank cells.  Any
    long rows are truncated.

  setrows rows
    'setrows n' sets the number of rows to 'n'.  If there are fewer
    than 'n' rows in the CSV files, then empty blank lines are added.

  head rows
  take rows
    'head n' and 'take n' (which are synonyms) take the first 'n'
    rows.  If there are fewer than 'n' rows, padding is not added.

  drop rows
    Drop the first 'rows' rows and return the rest (if any).

      Example:
        To remove the headings from a CSV file with headings:
          csvtool drop 1 input.csv > output.csv

        To extract rows 11 through 20 from a file:
          csvtool drop 10 input.csv | csvtool take 10 - > output.csv

  cat
    This concatenates the input files together and writes them to
    the output.  You can use this to change the separator character.

      Example: csvtool -t TAB -u COMMA cat input.tsv > output.csv

  paste
    Concatenate the columns of the files together and write them to the
    output.

      Example: csvtool paste input1.csv input2.csv > output.csv

  pastecol <column-spec1> <column-spec2> input.csv update.csv
    Replace the content of the columns referenced by <column-spec1> in the
    file input.csv with the one of the corresponding column specified by
    <column-spec2> in update.csv.

      Example: csvtool pastecol 2-3 1- input.csv update.csv.csv > output.csv

  join <column-spec1> <column-spec2>
    Join (collate) multiple CSV files together.

    <column-spec1> controls which columns are compared.

    <column-spec2> controls which columns are copied into the new file.

      Example:
        csvtool join 1 2 coll1.csv coll2.csv > output.csv

        In the above example, if coll1.csv contains:
          Computers,$40
          Software,$100
        and coll2.csv contains:
          Computers,$50
        then the output will be:
          Computers,$40,$50
          Software,$100,

  square
    Make the CSV square, so all rows have the same length.

      Example: csvtool square input.csv > input-square.csv

  trim [tlrb]+
    Trim empty cells at the top/left/right/bottom of the CSV file.

      Example:
        csvtool trim t input.csv    # trims empty rows at the top only
        csvtool trim tb input.csv   # trims empty rows at the top & bottom
        csvtool trim lr input.csv   # trims empty columns at left & right
        csvtool trim tlrb input.csv # trims empty rows/columns all around

  sub r c rows cols
    Take a square subset of the CSV, top left at row r, column c, which
    is rows deep and cols wide.  'r' and 'c' count from 1, or
    from 0 if -z option is given.

  replace <column-spec> update.csv original.csv
    Replace rows in original.csv with rows from update.csv.  The columns
    in <column-spec> only are used to compare rows in input.csv and
    update.csv to see if they are candidates for replacement.

      Example:
        csvtool replace 3 updates.csv original.csv > new.csv
        mv new.csv original.csv

  transpose input.csv
    Transpose the lines and columns of the CSV file.

  format fmt
    Print each row of the files according to the format 'fmt'.
    Each occurrence of "%i" or "%(i)" (where 'i' is a number) in
    'fmt' is replaced by the content of column number 'i' (remember
    that the leftmost column is numbered 1 in the traditional
    spreadsheet fashion).  A literal percent is obtained by doubling it.
    The usual escape sequences \n, \r, and \t are recognized.

      Example:
        csvtool format '%(1) -> %8%%\n' input.csv

  call command
    This calls the external command (or shell function) 'command'
    followed by a parameter for each column in the CSV file.  The
    external command is called once for each row in the CSV file.
    If any command returns a non-zero exit code then the whole
    program terminates.

      Tip:
        Use the shell command 'export -f funcname' to export
        a shell function for use as a command.  Within the
        function, use the positional parameters $1, $2, ...
        to refer to the columns.

      Example (with a shell function):
        function test {
          echo Column 1: $1
          echo Column 2: $2
        }
        export -f test
        csvtool call test my.csv

        In the above example, if my.csv contains:
          how,now
          brown,cow
        then the output is:
          Column 1: how
          Column 2: now
          Column 1: brown
          Column 2: cow

  readable
    Print the input CSV in a readable format.

Column specs:
  A <column-spec> is a comma-separated list of column numbers
  or column ranges.

    Examples:
      1                       Column 1 (the first, leftmost column)
      2,5,7                   Columns 2, 5 and 7
      1-3,5                   Columns 1, 2, 3 and 5
      1,5-                    Columns 1, 5 and up.

  Columns are numbered starting from 1 unless the -z option is given.

Input files:
  csvtool takes a list of input file(s) from the command line.

  If an input filename is '-' then take input from stdin.

Output file:
  Normally the output is written to stdout.  Use the -o option
  to override this.

Separators:
  The default separator character is , (comma).  To change this
  on input or output see the -t and -u options respectively.

  Use -t TAB or -u TAB (literally T-A-B!) to specify tab-separated
  files.

Options:
  -t Input separator char.  Use -t TAB for tab separated input.
  -u Output separator char.  Use -u TAB for tab separated output.
  -o Write output to file (instead of stdout)
  -z Number columns from 0 instead of 1
  -help  Display this list of options
  --help  Display this list of options

'Linux > Ubuntu' 카테고리의 다른 글

ubuntu dhcp lease log  (0) 2025.07.01
우분투에서 스타크래프트 시도.. 실패  (0) 2025.06.28
netplan  (0) 2025.03.06
ubuntu 24.04 네트워크 연결 중 문제  (0) 2025.02.26
ubuntu evince(pdf 뷰어/문서보기), gedit 검색  (0) 2024.11.25
Posted by 구차니
Linux/Ubuntu2025. 7. 1. 12:31

gpt 가라사대

cat /var/lib/dhcp/dhclient.leases

 

dhclient를 실행하고 나서 생성되는 로그인듯 하다.

 

아무튼 어쩌다 보니(?) 유선은 문제 없어 보이는데 무선의 경우 dhcp 대역이 이상해서 확인해보니

dhcp 서버가 예상한 192.168.10.1이 아닌 10.75로 설정되어있는것을 확인

아.. dhcp 서버가 두개 있어서 이놈들이 헤까닥 했구나..

lease {
  interface "wlo1";
  fixed-address 192.168.10.163;
  option subnet-mask 255.255.0.0;
  option routers 192.168.10.1;
  option dhcp-lease-time 86400;
  option dhcp-message-type 5;
  option domain-name-servers 192.168.10.1;
  option dhcp-server-identifier 192.168.10.75;
  option host-name "minimonk-notebook";
  option domain-name "vyos.net";
  renew 2 2025/07/01 12:34:49;
  rebind 3 2025/07/02 00:07:12;
  expire 3 2025/07/02 03:07:12;
}

 

+

sudo dhclient wlo1

'Linux > Ubuntu' 카테고리의 다른 글

csvtool  (0) 2025.07.11
우분투에서 스타크래프트 시도.. 실패  (0) 2025.06.28
netplan  (0) 2025.03.06
ubuntu 24.04 네트워크 연결 중 문제  (0) 2025.02.26
ubuntu evince(pdf 뷰어/문서보기), gedit 검색  (0) 2024.11.25
Posted by 구차니
Linux/Ubuntu2025. 6. 28. 13:52

lutris 까진 설치했는데 battle.net 에서 45%를 못 넘기고 뻗는다.

걍 윈도우 설치하는게 속 편하려나..

찾아보니 윈도우 보다 사양이 많이 올라간다고 하니 흐음...

 

[링크 : https://leedaeeun.tistory.com/108]

'Linux > Ubuntu' 카테고리의 다른 글

csvtool  (0) 2025.07.11
ubuntu dhcp lease log  (0) 2025.07.01
netplan  (0) 2025.03.06
ubuntu 24.04 네트워크 연결 중 문제  (0) 2025.02.26
ubuntu evince(pdf 뷰어/문서보기), gedit 검색  (0) 2024.11.25
Posted by 구차니
Linux/Ubuntu2025. 3. 6. 15:14

우분투 서버 설치하는데 netplan-zz 이런식으로 이름이 붙길래 먼가 해서 찾아봤더니

2018 이후 부터 netplan이 적용되었고 /etc/network/interfaces를 대체한다고 한다.

 

[링크 : https://feelsogoodcamp.tistory.com/35]

[링크 : https://bongjasee.tistory.com/4]

[링크 : https://documentation.ubuntu.com/server/explanation/networking/about-netplan/index.html]

[링크 : https://netplan.io/]

Posted by 구차니
Linux/Ubuntu2025. 2. 26. 22:56

ubuntu 24.04 에서 gateway아 dns가 설정되지 않으면

연결 확인에서 "연결됨"으로 넘어가지 못하고 계속 "연결 중"으로 남아있는데

그 때 연결 상태를 확인하기 위해 무언가를 40 초 근처의 간격으로 시도하는지

잠깐 끊어지는 현상이 발생한다.

 

아래는 ip와 subnet만 설정한 상태인데 "연결 중"으로 뜬다.

 

아무생각 없이 게이트웨이나 네임서버를 넣어주었더니 금세 연결됨으로 바뀐다.

enp1s0f0 "연결됨" 야이.. -_-

 

그래서 enp1s0f1 에는 dns 대신 gateway를 넣어주니

 

"연결됨"  야이 -_-

----

22.04 에서 해보니

게이트웨이가 없어도 연결됨으로 뜬다.

 

하나는 게이트웨이 다른 하나는 dns를 했어야 했나?

 

아무튼 일주일 간의 개고생은 의외로 단순하게(?)

ubuntu 24.04 로 올라가면서(?) 네트워크 연결 상태 확인이 달라져서 그런걸로.

그리고 게이트웨이를 넣어주는걸로 해결 -_-

'Linux > Ubuntu' 카테고리의 다른 글

우분투에서 스타크래프트 시도.. 실패  (0) 2025.06.28
netplan  (0) 2025.03.06
ubuntu evince(pdf 뷰어/문서보기), gedit 검색  (0) 2024.11.25
dpkg로 설치한 패키지 삭제하기  (0) 2024.09.06
24.04 설치 성공  (0) 2024.08.18
Posted by 구차니
Linux/Ubuntu2024. 11. 25. 11:48

ubuntu 22.04에서

pdf를 보다 검색 창에 우클릭하면

"대소문자 구별"과 "전체 단어 일치"가 나타난다.

이 정도는... 별도 메뉴로 보여달라고.. -_-

 

[링크 : https://askubuntu.com/questions/920545/where-are-the-case-sensitive-and-whole-words-search-options-in-evince-document-v]

 

+

gedit 에서도 해보니 검색창에 우클릭시 대소문자 / 전체 / 정규식 등의 옵션이 존재한다.

'Linux > Ubuntu' 카테고리의 다른 글

netplan  (0) 2025.03.06
ubuntu 24.04 네트워크 연결 중 문제  (0) 2025.02.26
dpkg로 설치한 패키지 삭제하기  (0) 2024.09.06
24.04 설치 성공  (0) 2024.08.18
우분투.. 버전 업그레이드 버근가?  (0) 2024.08.17
Posted by 구차니
Linux/Ubuntu2024. 9. 6. 11:26

dpkg -l로 패키지 목록을 확인하고

-r로 삭제하면 되는 듯.

 

$ sudo dpkg -r st-stm32cubeide-<version>

[링크 : https://community.st.com/t5/stm32cubeide-mcus/how-do-i-properly-uninstall-a-previous-cubeide-version-in-linux/td-p/217927]

Posted by 구차니
Linux/Ubuntu2024. 8. 18. 16:19

어찌어찌 겨우겨우 설치 성공

rufus 에서 GPT 파티션으로 설치하게 한다음

부트 옵션에서 EFI 로 선택해 /boot/efi/ubunut.efi 였나/ 그걸 선택해서 겨우 설치완료

elitebook 2760p의 UEFI 지원이 미흡해서 그런진 모르겠지만

22.10 이후 부터 UEFI로 강제되면서 설치가 좀 어려워진 감이 있나 보다.. 정도로 요약

[링크 : https://askubuntu.com/questions/1406886/does-ubuntu-22-04-require-a-uefi-instead-of-a-bios]

Posted by 구차니
Linux/Ubuntu2024. 8. 17. 22:38

22.04 사용중이고

24.04가 나온지 오래되었는데 왜 do-relase-upgrade를 하면 없다고 나올까?

-d 옵션은 개발 릴리즈인데 왜 이걸로 해야 24.04가 나올까?

  -d, --devel-release   지원되는 최신 릴리스를 사용하는 경우, 개발 릴리스로 업그레이드하십시오

 

do-release-upgrade -c
새 우분투 배포판 확인
사용 가능한 LTS의 개발 버전이 없습니다.
최신 non-LTS 개발 릴리스로 업그레이드 하려면 
/etc/update-manager/release-upgrades 에서 Prompt=normal 을 설정합니다.

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"
minimonk@mini2760p:~$ 

cat /etc/update-manager/release-upgrades
# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting and upgrade behavior, valid options:
#
#  never  - Never check for, or allow upgrading to, a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the supported release that immediately succeeds the
#           currently-running release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that if this option is used and
#           the currently-running release is not itself an LTS release the
#           upgrader will assume prompt was meant to be normal.
Prompt=lts

$ do-release-upgrade -d
새 우분투 배포판 확인

= Welcome to Ubuntu 24.04 LTS 'Noble Numbat' =

The Ubuntu team is proud to announce Ubuntu 24.04 LTS 'Noble Numbat'.

To see what's new in this release, visit:
  https://wiki.ubuntu.com/NobleNumbat/ReleaseNotes

Ubuntu is a Linux distribution for your desktop or server, with a fast
and easy install, regular releases, a tight selection of excellent
applications installed by default, and almost any other software you
can imagine available through the network.

We hope you enjoy Ubuntu.

== Feedback and Helping ==

If you would like to help shape Ubuntu, take a look at the list of
ways you can participate at

  http://www.ubuntu.com/community/participate/

Your comments, bug reports, patches and suggestions will help ensure
that our next release is the best release of Ubuntu ever.  If you feel
that you have found a bug please read:

  http://help.ubuntu.com/community/ReportingBugs

Then report bugs using apport in Ubuntu.  For example:

  ubuntu-bug linux

will open a bug report in Launchpad regarding the linux package.

If you have a question, or if you think you may have found a bug but
aren't sure, first try asking on the #ubuntu or #ubuntu-bugs IRC
channels on Libera.Chat, on the Ubuntu Users mailing list, or on the
Ubuntu forums:

  http://help.ubuntu.com/community/InternetRelayChat
  http://lists.ubuntu.com/mailman/listinfo/ubuntu-users
  http://www.ubuntuforums.org/


== More Information ==

You can find out more about Ubuntu on our website, IRC channel and wiki.
If you're new to Ubuntu, please visit:

  http://www.ubuntu.com/


To sign up for future Ubuntu announcements, please subscribe to Ubuntu's
very low volume announcement list at:

  http://lists.ubuntu.com/mailman/listinfo/ubuntu-announce


계속 [yN]

'Linux > Ubuntu' 카테고리의 다른 글

dpkg로 설치한 패키지 삭제하기  (0) 2024.09.06
24.04 설치 성공  (0) 2024.08.18
/dev/tty에서 한글 출력하기 fbterm  (0) 2024.08.16
gpm - general purpose mouse  (0) 2024.08.16
ubuntu wake up  (0) 2024.08.12
Posted by 구차니
Linux/Ubuntu2024. 8. 16. 17:40

zhcon 이라는걸 발견했는데 한글 출력은 안된다.

[링크 : https://manpages.ubuntu.com/manpages/trusty/man1/zhcon.1.html]

 

luit를 사용하면 iso 2022를 지원한다는데 iso 8859-1을 넣어도 안되고.. 멀까..

$ luit -encoding gbk cat a_chinese_file.txt

[링크 : https://unix.stackexchange.com/questions/149348/]

 

fbterm 이라는 별도의 프로그램을 이용하면 콘솔에서도 한글을 볼 수 있다(입력은... ㅠㅠ)

[링크 : https://askubuntu.com/questions/193391/how-do-i-display-chinese-japanese-characters-in-a-linux-vt-console]

'Linux > Ubuntu' 카테고리의 다른 글

24.04 설치 성공  (0) 2024.08.18
우분투.. 버전 업그레이드 버근가?  (0) 2024.08.17
gpm - general purpose mouse  (0) 2024.08.16
ubuntu wake up  (0) 2024.08.12
우분투 swraid로 설치하기  (0) 2024.07.31
Posted by 구차니