Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

After 14 non-maintainer releases, I'm the S-Lang non-maintainer. -- Ray Dassen


computers / comp.unix.shell / latest

Re: (Linux) Convert text to Excel (and back) - what are people's preferred methods? (thread)

comp.unix.shell

Posted: 3 Days 15 Hours ago by: Eli the Bearded

In comp.unix.shell, Kenny McCormack <gazelle@shell.xmission.com> wrote:

Re: (Linux) Convert text to Excel (and back) - what are people's (thread)

comp.unix.shell

Posted: 3 Days 17 Hours ago by: Kenny McCormack

.... Actually, step 3 is about converting from tab-delimited to XLS, but I get the your meanining. To do this in full generality, you'd need to preserve it when you went down to text so that you could put it back when you went back up to

Re: (Linux) Convert text to Excel (and back) - what are people's (thread)

comp.unix.shell

Posted: 3 Days 18 Hours ago by: Lew Pitcher

I can't speak to your step 3; I don't know of any way to preserve the metadata (column width, highlighting, etc) when converting an XLS file to CSV. However, I can suggest a simplification of your steps 1 and 2: use LibreOffice/OpenO

(Linux) Convert text to Excel (and back) - what are people's preferred methods?

comp.unix.shell

Posted: 3 Days 19 Hours ago by: Kenny McCormack

1) From Excel, write it out as a text file (tab delimited). 2) Work on it in Linux, using, e.g., AWK, creating a new tab-delimited file. 3) Load the tab-delimited file back into Excel This, of course, works fine, but is tediou

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 6 Days 10 Hours ago by: hongy...@gmail.com

$ echo "0x20 0x09 0x0a" | xargs -n1 ascii -a|grep names Other names: Space, Blank Other names: Horizontal Tab, \t Other names: Newline, \n

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 7 Days 6 Hours ago by: Kees Nuyt

1: Explore the options in 'man -s 1 ascii' and try ascii -a 0xHH ... plus a bit of awk code 2: You don't have to, because from experience you know 0x20 is space, 0x09 is TAB and 0x0A is linefeed 3: Use the lookup table in 'man

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 7 Days 6 Hours ago by: hongy...@gmail.com

I checked them with the following command: $ ascii -t 0x20 0x09 0x0a 2/0 32 0x20 0o40 00100000 0/9 9 0x09 0o11 00001001 0/10 10 0x0A 0o12 00001010 How to retrieve the character names at the same time? HZ

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 8 Days 1 Hour ago by: Janis Papanagnou

The output isn't the same because you used a different program. The IFS value is the same. Of course the unnecessary > and < will distract you from the IFS dedails in the od/hexdump output. Keep it simple $ printf '%s' "$IFS" | od -t x

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 8 Days 2 Hours ago by: hongy...@gmail.com

I get the following using od: $ printf '>%s<' "$IFS"| od -xc --endian=big 0000000 3e20 090a 3c00 > \t \n < 0000005 Why aren't they exactly the same? HZ

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 8 Days 6 Hours ago by: Kees Nuyt

No, it isn't empty. The characters it contains just do not leave ink on your canvas. user@host:~ $ printf '>%s<' "$IFS"|hexdump -C 00000000 3e 20 09 0a 3c |> ..<| 00000005

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 8 Days 10 Hours ago by: hongy...@gmail.com

It's empty on my machine (Ubuntu 20.04.3 LTS): $ echo $IFS $

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 10 Days 1 Hour ago by: Kaz Kylheku

IFS is analogous to an important environmental register in a machine language ABI, such as a global offset pointer register. Code which wants to manipulate it must save the value, and restore it not only when it is done, but around calls

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 10 Days 1 Hour ago by: Lew Pitcher

Good catch!

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 10 Days 3 Hours ago by: Geoff Clare

Double quotes around $# are redundant only if there are no digits in IFS. That would certainly be true for the case the OP asked about, where the $# expansion was in the first command executed in the script. But it can't be assumed to

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 10 Days 14 Hours ago by: hongy...@gmail.com

Thank you for your prudent analysis.

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 10 Days 14 Hours ago by: hongy...@gmail.com

Thank you for your advice and suggestions. HZ

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 10 Days 16 Hours ago by: Janis Papanagnou

In your thread you have asked a question about using the test command and quoting to address some issues and, based on some sample code from the net, understand how it works best. In this context it is noteworthy that (for own programs) y

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 11 Days 1 Hour ago by: Lew Pitcher

As a specific solution, yes. $# is guaranteed to contain a numeric count of the number of arguments passed into a script. It *cannot* be empty, or contain space delimited values, so bracketing it in doublequotes is redundant. Both sides

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 11 Days 11 Hours ago by: hongy...@gmail.com

Yes. All the problems discussed in this post can be illustrated by the following examples: $ [ "$FOO" = 1 ]; echo $? 1 $ [ "$FOO" = "1" ]; echo $? 1 $ [ $FOO -ne 1 ] bash: [: -ne: unary operator expected $ [ "$FOO" -ne 1 ] bash: [: : i

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 11 Days 13 Hours ago by: Janis Papanagnou

$FOO is an arbitrary user defined (or undefined) variable. $# is a numeric variable set by the shell. So [ $FOO -ne 1 ] will not avoid the issue. Of course just trying that code would be faster than writing a post.

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 11 Days 13 Hours ago by: hongy...@gmail.com

As commented by others in this thread, the following method will avoid this problem? [ $# -ne 1 ]

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 11 Days 19 Hours ago by: hymie!

Consider a different variable if [ $FOO != 1 ] ; then if $FOO is completely uninitialized, then this will expand to if [ != 1 ] ; then which is a syntax error. That is the reason that I, personally, almost always use the extra quota

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 11 Days 23 Hours ago by: Kenny McCormack

.... Like you said above, there is no difference. And there are about thousand other ways of doing it as well. Take your pick...

(suspend && lock screen) vs (lock screen && suspend)

comp.unix.shell

Posted: 12 Days 1 Hour ago by: Ottavio Caruso

Hi, Not sure if this just a command invocation problem or there are other issues at hand (say, power management, etc) but... I have a script that binds to 'CTRL + SHIFT + S': $ cat opt/bin/lock-suspend #!/bin/sh systemctl suspend && m

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 12 Days 2 Hours ago by: Janis Papanagnou

Why did you post this here-doc code which is completely unrelated to your question? On Stackoverflow I experienced a couple of "experts" that spread the wisdom of "always quote variable expansions"; this is fine as a rule of thumb (but

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 12 Days 3 Hours ago by: Kees Nuyt

Both are possible. If they had written: :: [ $# != 1 ] you might have asked: :: It seems that [ "$#" != "1" ] is enough. :: Why use [ $# != 1 ] here? Not surprisingly, there is even another way to do it: :: [ $# -ne 1 ] I hope this h

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 12 Days 3 Hours ago by: Lew Pitcher

I see no /obvious/ reason. On a (perhaps) related note, why did the author of that code snippet use a string test rather than an an arithmetic test? To me, the code snippet should read if [ $# -ne 1 ] then echo 'Usage: test.sh <

Re: [ "$#" != "1" ] vs [ $# != 1 ] (thread)

comp.unix.shell

Posted: 12 Days 3 Hours ago by: Chris Elvidge

Why not try [ $# -ne 1 ] ?

[ "$#" != "1" ] vs [ $# != 1 ]

comp.unix.shell

Posted: 12 Days 9 Hours ago by: hongy...@gmail.com

``` #!/bin/sh if [ "$#" != "1" ]; then echo "Usage: test.sh <string>" exit 1 fi; gap -r -b -q << EOI LoadPackage( "CrystCat" ); DisplaySpaceGroupType( "$1" ); EOI ``` It seems that [ $# != 1 ] is enough. Why use [ "$#" != "1" ] h

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 13 Days 17 Hours ago by: Janis Papanagnou

I don't have subdirectories, that's why I said it serves me best. Ah, right. I might then replace that code by printf "%s\n" rfcs/* | sort -t/ -k2.4,2.7n | tar czf rfcs.tgz -T - which (as a shell built-in) doesn't have that limit. (

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 13 Days 17 Hours ago by: Brian Patrie

Just beware that subdirectories under rfcs/ may bugger things up. Also, too many files might run you into the argv length limit (though that's mighty huge, these days).

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 13 Days 18 Hours ago by: Brian Patrie

It did for me. Yes, "-type f" would probably solve the same problem, as "--no-recursion", as long as no other types need to be caught, and you don't need directory metadata in the archive (which may be desirable, depending on the use

Re: Use regexp to build the symbols list defined in GAP and its (thread)

comp.unix.shell

Posted: 14 Days 2 Hours ago by: hongy...@gmail.com

Got it. In fact, it's done by using the gap language itself [1]. [1] https://github.com/feisele/vscode-gap-language-support/issues/2#issuecomment-1120965434 Regards, HZ

Re: Use regexp to build the symbols list defined in GAP and its (thread)

comp.unix.shell

Posted: 14 Days 5 Hours ago by: Janis Papanagnou

Why do you think these data haven't already been collected by a regexp search? That's at least what I regularly do; filter data (including source code) to extract data that I comprise in some other context, often manually adding the surr

Use regexp to build the symbols list defined in GAP and its plugin packages.

comp.unix.shell

Posted: 14 Days 7 Hours ago by: hongy...@gmail.com

I noticed this file [1] includes almost all the symbols defined in GAP [2] and its plugin packages. But I think this should be created by searching gap source code using some complex regular expressions. I try to figure out the regex, but

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 15 Days 2 Hours ago by: Helmut Waitzmann

Strange.  I checked the manual page at my system (Debian buster) and it's indeed the same as yours.  But the GNU find info manual at my system says what I cited above.  The online GNU find info manual (<https://www.gnu.org/soft

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 15 Days 4 Hours ago by: Axel Reichert

Thanks. Spotting inconsistencies did not occur to me, although I have often used sorting for this. Me too, a habit passed on by my father. It also helps to find structure in the data and thus, contrary to its bean-counting image might

%s in strftime(3) vs. %s in find(1) (Was: tar files sort order by date or numeric name) (thread)

comp.unix.shell

Posted: 15 Days 5 Hours ago by: Kenny McCormack

.... I think the problem is that %s was already "taken" by "find" to mean "size", so they couldn't use %s (from strftime) to mean seconds since the epoch. So, they had to come up with something else (for "find" to use).

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 15 Days 7 Hours ago by: Janis Papanagnou

Sure. In short: sorted item lists let you find specific items or detect inconsistencies easier on inspection or on comparison with other data. If I inspect a foreign tar file I typically inspect the contents before the decision of unpack

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 15 Days 8 Hours ago by: Axel Reichert

After the IMHO fruitful discussion I would like to ask why you want to have them in sorted order in your tar file. I could not come up with a motivation for this myself. Could you please explain? Best regards Axel

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 15 Days 9 Hours ago by: Spiros Bousbouras

The man page says %Ak File's last access time in the format specified by k, which is either `@' or a directive for the C `strftime' function. The pos- sible values for k are listed below; some of the

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 15 Days 18 Hours ago by: Helmut Waitzmann

I considered using "%T@" but refrained from using it because of the paragraph in the GNU find info manual:  "Below are the formats for the directives '%A', '%C', and '%T', which print the file's timestamps. Some of these formats might

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 15 Days 22 Hours ago by: Spiros Bousbouras

For sorting using modification time it's simpler to do find dir-with-files/ -printf '%T@ %p\0' | sort -z -n -k1 | gawk 'BEGIN { RS = "\0" } {print $2}' | etc.

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 15 Days 22 Hours ago by: Janis Papanagnou

Thanks for you reply. The nice thing about Unix is that we can construct solutions of arbitrary complexity solving (almost) every imaginable task. The task I have presented is quite primitive. With the previous posts I think using someth

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 15 Days 23 Hours ago by: Helmut Waitzmann

The trick of a thorough inspection of the GNU tar info manual (not just the manual page, but see the SEE ALSO section of the manual page for how to get it), will reveal the options "--no-recursion", "--null", and "--files-from", which

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 1 Hour ago by: Janis Papanagnou

With the 'sort' step I can use sort's -kn feature because of the regularity of the file names in this case. Thanks. Janis

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 8 Hours ago by: Axel Reichert

Ah, this avoids my xargs, great! [...] Would this be done otherwise, even though the files are given directly on the command line as arguments (respectively read from STDIN) and not created by globbing? Is my understanding correct

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 8 Hours ago by: Brian Patrie

You can also use "-T -" to read the list of files from stdin. So: find dir-with-files | sort --version-sort \ | tar -czvf sorted.tgz --sort=none --no-recursion -T - I'm abusing sort's "--version-sort" option to get the order that J

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 14 Hours ago by: Janis Papanagnou

I forgot to mention that this was the place where I'd have expected some, say, --sort=mtime option variants. That way the call that I currently use to create the tar file - I'm just tar'ing the directory that contains the actual files -

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 14 Hours ago by: Janis Papanagnou

I missed that. Thanks. Janis

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 14 Hours ago by: Janis Papanagnou

That's what I also had found in the man page, and none of the three options will sort by date or by name with a numeric variable-length numeric component. With 'name' the order would be and with the other options arbitrary w.r.t. the stat

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 14 Hours ago by: Janis Papanagnou

Too brittle? - Hmm.. - thinking about what happens if the arguments' length will result in more than one call of tar triggered by xargs. But I suppose using also the tar option to add to an existing archive will solve that issue. Thanks.

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 21 Hours ago by: marrgol

Here a quick man page inspection reveals: “--sort=ORDER When creating an archive, sort directory entries according to ORDER, which is one of none, name, or inode.”

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 21 Hours ago by: Christian Weisgerber

Various tar(1) implementations can read a list of files to archive. $ ls | sort >list $ tar -c -I list -f sorted.tar GNU tar also supports this. $ gtar -c -T list -f sorted.tar

Re: tar files sort order by date or numeric name (thread)

comp.unix.shell

Posted: 16 Days 21 Hours ago by: Axel Reichert

I assume that something along ls -tr dir-with-files/ | xargs tar cf sorted.tgz is too brittle for you? Best regards Axel

tar files sort order by date or numeric name

comp.unix.shell

Posted: 16 Days 22 Hours ago by: Janis Papanagnou

I want the files in a tar archive in sorted form. (Using GNU tar.) Either by date of the file or by its name (containing a number). For example I want these three files in sorted order like depicted: rfc748.txt rfc7168.txt rfc8774.txt I c

Re: Find Local Sex Dating, Girls Local One Night Stand - Women Near (thread)

comp.unix.shell

Posted: 20 Days 6 Hours ago by: james Darrenn

Looking for local sex

Re: Bash - Can I create cascading aliases, that is an alias of an (thread)

comp.unix.shell

Posted: 20 Days 6 Hours ago by: Ottavio Caruso

Thanks.

Re: Gap script: `QUIT;` vs `quit;`. (thread)

comp.unix.shell

Posted: 22 Days 1 Hour ago by: Lew Pitcher

Apparently, you don't "understand the difference between" QUIT and quit. And, you certainly don't understand the scope of the help you can get in comp.unix.shell. Your question has nothing to do with the unix shell, and, if you need cla

Re: Gap script: `QUIT;` vs `quit;`. (thread)

comp.unix.shell

Posted: 22 Days 1 Hour ago by: hongy...@gmail.com

Thank you. I understand the difference between them: 1. quit type 'quit;' to quit to outer loop 2. In manual, the following description is used: 6.7.1 QUIT

Re: Gap script: `QUIT;` vs `quit;`. (thread)

comp.unix.shell

Posted: 22 Days 1 Hour ago by: Lew Pitcher

[snip] I suggest checking out the FAQ at https://www.gap-system.org/Faq/faq.html and the documentation at https://www.gap-system.org/Doc/doc.html If you still have problems, try using the contacts at https://www.gap-system.org/Contacts

Gap script: `QUIT;` vs `quit;`.

comp.unix.shell

Posted: 22 Days 2 Hours ago by: hongy...@gmail.com

$ cat gap-test.g Display(SmallGroup(8,1)); QUIT; $ gap gap-test.g ┌───────┐ GAP 4.12dev-1280-g6feeb8c built on 2022-04-25 14:24:55+0800 │ GAP │ https://www.gap-system.org └───────┘ Arc

Re: Bash - Can I create cascading aliases, that is an alias of an (thread)

comp.unix.shell

Posted: 22 Days 22 Hours ago by: David W. Hodgins

In GNU bash, version 5.1.4(1)-release the text in "man bash", the first paragraph in the ALIASES section ends with ... If the last character of the alias value is a blank, then the next command word following the alias is also ch

Re: Bash - Can I create cascading aliases, that is an alias of an (thread)

comp.unix.shell

Posted: 23 Days 5 Hours ago by: Ottavio Caruso

Ah, thanks. That's the one I was looking for. It's buried somewhere in the man page (hints are welcome) but I can't find it. However... I agree.

Re: Bash - Can I create cascading aliases, that is an alias of an (thread)

comp.unix.shell

Posted: 23 Days 11 Hours ago by: Janis Papanagnou

Or just use shell functions to avoid the restrictions of aliases and get the advantages of both. Janis

Re: Bash - Can I create cascading aliases, that is an alias of an alias? (thread)

comp.unix.shell

Posted: 23 Days 14 Hours ago by: Eli the Bearded

Yes. I'd say that method sucks, however. Personally I use a wrapper script for yt-dlp that sets my preferred options and gives me handy command line shortcuts. But you can do some fun stuff with aliases. When an alias definition ends wi

Re: Bash - Can I create cascading aliases, that is an alias of an (thread)

comp.unix.shell

Posted: 23 Days 20 Hours ago by: Chris Elvidge

You type this _once_ into your .bash_aliases! You could even repeat lines. Too much trouble? Or are you just trolling?

Re: Bash - Can I create cascading aliases, that is an alias of an (thread)

comp.unix.shell

Posted: 23 Days 23 Hours ago by: Fenris

So why don't you just try it?

Bash - Can I create cascading aliases, that is an alias of an alias?

comp.unix.shell

Posted: 24 Days ago by: Ottavio Caruso

Hi, Assuming: alias yt='/home/user/bin/yt-dlp' and I want have more aliases incorporating this alias: alias yt-native='yt --hls-prefer-native" alias alias yt-auth='yt -u user@email.com -p password" so that I don't have to repeat the

new interactive utility: pw ("Pipe Watch").

comp.unix.shell

Posted: 24 Days 16 Hours ago by: Kaz Kylheku

Hi All, I wrote an interative utility called "pw". This works similarly to a pager: yourcommand | pw Man page and git repo: https://www.kylheku.com/cgit/pw/tree/pw.1 Just like an interative pageer such as "less", Like a pager, pw rea

Re: Run multiple make in parallel with appropriate cores settings for each of them. (thread)

comp.unix.shell

Posted: 27 Days 3 Hours ago by: Kees Nuyt

+1

Re: Run multiple make in parallel with appropriate cores settings for (thread)

comp.unix.shell

Posted: 27 Days 4 Hours ago by: Richard Harnden

This [...] desends into a subdir and starts the build in the background. So: either wait for each background job in finish if PARALLEL != yes, or let 4 jobs run at once. You make everything way too complicated. I would say that if y

Run multiple make in parallel with appropriate cores settings for

comp.unix.shell

Posted: 27 Days 12 Hours ago by: hongy...@gmail.com

``` PARALLEL=no [...] while [[ "$#" -ge 1 ]]; do option="$1" ; shift case "$option" in [...] --parallel) PARALLEL=yes; ;; [...] esac done [...] if [ "x$PARALLEL" = "xyes" ] && [ "x$STRICT" = "xyes" ]; then error "The

73 recent articles found.

rocksolid light 0.7.2
clearneti2ptor