Search Results

Search: Posts Made By: mij
6,688
Posted By mij
In a way it is only the shell using the IFS as...
In a way it is only the shell using the IFS as read is a built-in command, at least for the shells I use.

Although I take your point, MadeInGermany. It affects how read interprets its input but...
6,688
Posted By mij
I knew it had to be something simple, I did not...
I knew it had to be something simple, I did not realize it was just a case of ls also needing the IFS to be null too. For my needs both solutions work perfectly but that version is the most...
6,688
Posted By mij
Expanding a list of wildcard filenames with spaces
I think I must be missing something obvious but I have a file containing a list of files and paths, some with wildcard, others with spaces. e.g.

/this/is/a/file
/this/is/a/directory/...
3,610
Posted By mij
The following forms work for me (local machine...
The following forms work for me (local machine running 10.8.1, remote machine running 10.5.8):

ssh MYSERVERNAME "osascript -e 'tell application \"System Events\" to return name of every process...
2,706
Posted By mij
Each line has a number, right aligned with...
Each line has a number, right aligned with leading spaces, which takes up the first 16 characters, a space, then an unquoted string of variable length that can include any characters. There is...
2,706
Posted By mij
In my script I use sort before uniq so the data...
In my script I use sort before uniq so the data is sorted. I assume that would still be more efficient than having awk perform the sort itself?

Thanks.
2,706
Posted By mij
Unfortunately uniq will still check the whole...
Unfortunately uniq will still check the whole line for uniqueness. Also BSD uniq annoyingly does not include the -D (--all-repeated) switch either.
2,706
Posted By mij
Rewriting GNU uniq in awk
Within a shell script I use

uniq -w 16 -D

in order to process all lines in which the first 16 characters are duplicated.

Now I want to also run that script on a BSD based system where the...
Forum: Linux 04-17-2012
2,481
Posted By mij
Repeated corruption running linux on USB flash drive
I have a HP Proliant N40L server and in the internal USB socket I have a 16GB HP v195b flash drive on which I have a full copy of Debian installed from a copy of the DVD1 ISO image.

In as far as...
5,325
Posted By mij
Thanks fmurphy for pointing out that important...
Thanks fmurphy for pointing out that important caveat. It could be easily adapted to use parted, but I do not have it installed on my current system. I have used it in a similar script in the past...
5,325
Posted By mij
I had the same question, and was surprised not to...
I had the same question, and was surprised not to have found any explanation on the web, so thanks to Corona688 for revealing it has a very simple answer.

As a result I have put together a quick...
3,940
Posted By mij
With the possibility of different characters...
With the possibility of different characters within the parenthesis it is definitely easier to use sed as using just BASH would require different steps. In that case this is the expression I would...
3,940
Posted By mij
Probably not the most efficient solution, and...
Probably not the most efficient solution, and maybe better done in sed, but in BASH this is how I would do it:

for FN in *; do mv $FN "`echo ${FN#*|} | tr -d ':|' | tr '()-' '_'`"; done
...
2,472
Posted By mij
I always forget about eval, too much time spent...
I always forget about eval, too much time spent in other languages where similar functions are only desperate last resorts.

That worked perfectly, thanks.
2,472
Posted By mij
Extracting unknown positional parameter in Bourne shell
I have a variable that contains the number of a positional parameter. There is no way of knowing what number this may be, although it is guaranteed to correspond with a valid parameter.

In BASH I...
1,113
Posted By mij
If you only need the filename then there is no...
If you only need the filename then there is no need to use the -l flag on ls, which also saves you have to pipe to awk.

tail `cd path; ls -rt | tail -1`

Using backticks (`) will execute the...
9,808
Posted By mij
That is exactly what I wanted. Everything tested...
That is exactly what I wanted. Everything tested okay and I have been able to update my script.

I feel so stupid now. I have read the find man page so often I should have known that.

Many...
9,808
Posted By mij
I have just tried that, and although it works, it...
I have just tried that, and although it works, it is executing the commands individually for each file. Presumably this means it is not offering any performance advantage over that just using find's...
9,808
Posted By mij
Display find results, and pipe to xargs
I have an overnight script which runs across a large directory to repair permissions and ownership. I also have this command output the list of files affected so that cron can email these as a log...
1,562
Posted By mij
In a regular expression parentheses are used to...
In a regular expression parentheses are used to group characters, so you need to escape them if you mean to use them as characters to match.

\(abcd\) will match occurrences of "(abcd)".
(abcd)...
11,484
Posted By mij
It is always something simple! I probably should...
It is always something simple! I probably should quote everything anyway to be safe, I do have files with spaces, but just quoting the ${FS_EXCLUDE[@]} variable was the missing piece to make the...
11,484
Posted By mij
Passing wildcard parameters to find via a variable
I have a script to fix permissions which is made up of blocks like:

FS_ROOT=/home/shared/Photos
FS_EXCLUDE=( \( -path */.webviews -o -path */.thumbnails \) -prune -o )
find $FS_ROOT...
11,832
Posted By mij
Would the single quotes still have that effect...
Would the single quotes still have that effect inside double quotes?

It fixed the problem though, in hindsight I was being totally dumb using them to prevent globbing when this never would have...
11,832
Posted By mij
Using variables for exclusion in tar
Hello.

I am writing a backup script which uses a function to create a tar archive for a specified directory. For some reason though I cannot get tar to exclude a specified path when passed as a...
Showing results 1 to 24 of 24

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