Search Results

Search: Posts Made By: uiop44
1,511
Posted By uiop44
Plan9 sed - rationale for limitations
Using the 9base port in {Net,Free}BSD, it appears that Plan 9's sed

1. restricts the max number of sed commands and thereby the length of sed scripts

2. does not recognise the \nn flag where nn...
7,327
Posted By uiop44
I had another go at this without using xxd. ...
I had another go at this without using xxd.

This version uses only sh builtins, sed, jot/seq and dc.

Not thoroughly tested, but seems to work.

Handling unicode too would be useful.


#...
7,327
Posted By uiop44
URL decoding with awk
The challenge:

Decode URL's, i.e. convert %HEX to the corresponding special characters, using only UNIX base utilities, and without having to type out each special character.

I have an...
Forum: BSD 03-01-2012
5,430
Posted By uiop44
It's the standard FreeBSD /bin/sh, i.e. ash. ...
It's the standard FreeBSD /bin/sh, i.e. ash.

No doubt the answer lies in the source code. Still being a C noob, I gave up. But I may return to this since it has my curiousity.

I believe the...
Forum: BSD 02-17-2012
5,430
Posted By uiop44
I like it. But still I get nothing. I can't...
I like it.
But still I get nothing.
I can't figure out where the output is going.
Forum: BSD 02-17-2012
5,430
Posted By uiop44
jobs -l | sed ... = nothing!?
I can't seem to filter the output of jobs -l (/bin/sh).
Never had a problem with this on NetBSD.
Really strange.
It must be something really obvious I'm over looking.
What could it be?


jobs...
1,154
Posted By uiop44
[deleted]
[deleted]
Forum: Programming 07-28-2011
1,650
Posted By uiop44
JG: Would you believe I also omitted a typdef...
JG: Would you believe I also omitted a typdef that did just that? For the kelly example, I took the struct out of a context where I still don't fully understand the context. Hence the omissions.
...
Forum: Programming 07-28-2011
1,650
Posted By uiop44
JohnGraham: Would const be useful if the struct...
JohnGraham: Would const be useful if the struct was as follows?


const struct kelly {
/* ... */
void (*lg)(int);
} friends[] = {
/* ... */
};


Shamrock: Many thanks.

The "kelly"...
Forum: Programming 07-28-2011
1,650
Posted By uiop44
Using pointers to struct members as args to functions
In a well-known book on the C language, there is an example of an efficient method for using a struct member as an argument to a function. (I'm a C noob, but I believe the correct terminology might...
1,105
Posted By uiop44
That's exactly what I was looking for. I wanted...
That's exactly what I was looking for. I wanted to use case..esac.

Many thanks, Scrutinizer.

I once read something that suggested as jobs get larger, case..esac is faster than if..then. ...
1,105
Posted By uiop44
shell scripting question
Testing for the presence/absence of a pattern in a file, using /bin/sh:


while read a;
do
b="${a##*pattern*}";
[ "$b" = "" ];
done < file


This returns 0 if there's a match. That signal...
2,565
Posted By uiop44
solved
Found via the infamous sed one-liners file.



# delete last 2 lines of file

sed 'N;$!P;$!D;$d' < file
printf "This is the new line 4\n"
printf "\n"



---------- Post updated at 08:36...
2,565
Posted By uiop44
sed question - change 2d to last line in file
The file is repeating blocks of text separated by a blank line. Some of the lines are unique.

e.g.:

This is unique line
This is line 2
This is line 3
This is line 4

This is unique line...
2,849
Posted By uiop44
Conserving processes: execve() vs fork()
Disclaimer: This is just a rainy day experiment. There is no expected "goal" other than to understand UNIX better.

After reading about fork and exec, my understanding is that forking, as the...
2,000
Posted By uiop44
Would you believe it was simply a matter of me...
Would you believe it was simply a matter of me forgetting to use the -n operand with sed?

I tried to tag this post for deletion seconds later when I realised it. But I guess that didn't work.
...
2,000
Posted By uiop44
Bourne-sh (not bash) question about nested loops and sed
Here's the input:

alpha, numeric or alphanumeric string ("line 1 string")
numeric string ("line 2 string")
numeric string ("line 3 string")
numeric string ("line 4 string")
...

where
-...
5,044
Posted By uiop44
Let me rephrase. "bigfile" is actually not a...
Let me rephrase.

"bigfile" is actually not a file, it's a stream of bytes from the network.

What splitting to stdout means is that splitting does not require 2X the file size, i.e. bigfile +...
5,044
Posted By uiop44
csplit to stdout
I want to split big files based on a pattern to stdout.

Although csplit works well for me splitting the output into separate files (e.g. xx00, xx01, xx02, ...), the following is not working as...
12,388
Posted By uiop44
Thanks. This works great. But the new...
Thanks.

This works great. But the new status is not immediately reflected in the jobs -l output.

Can I get the status to update with another signal?

Certain events seem to trigger an...
12,388
Posted By uiop44
suspend a *background* running job
Is there a way to suspend (TSTP?) a job that is running in the background, _without_ first bringing it to the foreground and inputting Ctrl-Z from the keyboard?

IOW, something similar to issuing...
4,278
Posted By uiop44
Many, many thanks agama! It all works now....
Many, many thanks agama!

It all works now.

(Your first solution for the single quote actually works too. I hastily overlooked your single quotes around the forward slash.)

Great stuff. ...
4,278
Posted By uiop44
I see an escaped t in your sed command. That...
I see an escaped t in your sed command. That tells me you're using a sed that supports more than mine does (e.g., symbols for tabs, newlines, etc. plus octal and hex, if it's the GNU version).
...
4,278
Posted By uiop44
Question/review my script: removing bad chars from filenames
The task: remove undesirable characters from filenames.

Restrictions: Must use basic RE, base utilities (non-GNU) and /bin/sh (ash). No ksh, zsh, perl, etc.

Below is what I've come up with. It...
1,955
Posted By uiop44
Excellent! I've learnt something new! Cheers! ...
Excellent! I've learnt something new! Cheers! :)
Showing results 1 to 25 of 60

 
All times are GMT -4. The time now is 03:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy