Search Results

Search: Posts Made By: LessNux
1,366
Posted By LessNux
Perl: backslash in front of integer like \32768
In Perl, what does a backslash preceding an integer do like \32768 ?

The $/ section of perlvar writes:

local $/ = \32768; # or \"32768", or \$var_containing_32768


How is \32768 different...
6,709
Posted By LessNux
Thank you for your replies, Scrutinizer and drl. ...
Thank you for your replies, Scrutinizer and drl.


drl wrote:




I do not understand what are meant by "@(#)", "p1" and "p213".

Does "@(#)" have anything to do with an array variable?
...
6,709
Posted By LessNux
Regular expression to match multiple lines?
Using a regular expression, I would like multiple lines to be matched.

By default, a period (.) matches any character except newline. However, (?s) and /s modifiers are supposed to force . to...
9,249
Posted By LessNux
I recently got to know that, if a hash mark (#)...
I recently got to know that, if a hash mark (#) to begin a shell comment is not placed at the beginning of a line, then the hash mark must be preceded by a horizontal whitespace. (The # mark is also...
9,249
Posted By LessNux
My main purpose for the post #1 is to compare two...
My main purpose for the post #1 is to compare two copies (or two versions) of the script, ignoring comments and meaningless white spaces that do not affect execution.

If commands like diff or cmp...
9,249
Posted By LessNux
How to remove comments from a bash script?
I would like to remove comments from a bash script. In addition, I would like to remove lines that consist of only white spaces, and to remove blank lines.


#!/bin/bash
perl -pe 's/ *#.*$//g'...
13,480
Posted By LessNux
How to sort version numbers?
I would like to know how to sort version numbers, using bash or perl. I would like to sort file names that are program names with version numbers and extensions, such as hello-0.2.3.tar.gz and...
6,014
Posted By LessNux
Thanks, Chubler_XL. It was indeed awkward of...
Thanks, Chubler_XL.

It was indeed awkward of my code to invoke "sed" consecutively multiple times. The subroutines should be polished as you suggested.


#percent-encoding for null character...
6,014
Posted By LessNux
If I need to use (or reuse) the search result...
If I need to use (or reuse) the search result later but not immediately following "find", I would like to save it into a variable. However, the search result contains null characters as separators,...
6,014
Posted By LessNux
Thanks Corona688 for reminding me of named pipes....
Thanks Corona688 for reminding me of named pipes. However, the statement "mkfifo mypipe" creates a file "mypipe" in the current directory. I do not want to use any files explicitly. So, instead of...
6,014
Posted By LessNux
bash: How to reuse the search result of "find"
find . -type f -print0 | xargs -0 chmod 600

find . -type f



On bash, I would like to pass the search result of "find" to another command as well as to the standard output. The above code...
10,444
Posted By LessNux
Bash: How can a script create a script?
I need to write a bash script that will generate another bash script. Furthermore, the child script is required to be hard-coded into the parent script. The parent script is not allowed to import...
50,403
Posted By LessNux
Hello carldamon, You seem to have barged...
Hello carldamon,

You seem to have barged into my thread by posting a question that is not related to my original post.

Remove your post from this thread, and create a new thread of your own,...
50,403
Posted By LessNux
Bash: How to remove the last character of a string?
In bash, how can one remove the last character of a string? In perl, the chop function would remove the last character. However, I do not know how to do the same job in bash.

Many thanks in...
2,655
Posted By LessNux
user input in perl?
Please tell me how to write a perl script that asks the user to enter words and that passes them to a variable.

In bash, the "read" command would achieve such user interaction.


#!/bin/bash...
3,513
Posted By LessNux
No, my perl script is supposed to grow with more...
No, my perl script is supposed to grow with more statements. I would like all the operations to be done inside a perl script.
3,513
Posted By LessNux
perl's substitution operator "s" with file contents?
Please show me how to make substitution over the contents of a file in a perl script.

In a perl script, the core part of substitution operation is

s/FINDPATTERN/REPLACEPATTERN/g;

However, I...
3,604
Posted By LessNux
Do not remove "glob", please!
Do not remove "glob", please!
3,604
Posted By LessNux
That is not what I want. I need perl definitely....
That is not what I want. I need perl definitely. I need communication between bash and perl.
3,604
Posted By LessNux
How to selectively suppress perl output?
The following perl statement in a bash script consists of two substatements. I intend the first perl substatement (the assignment with glob) to get input from the preceding bash pipe, and the second...
2,845
Posted By LessNux
No, that is not what I want. Do not rely on the...
No, that is not what I want. Do not rely on the coincidence that the space I want to remove happens to follow a closing double quote.
2,845
Posted By LessNux
How to replace spaces excluding those within double quotes and after backslash?
In bash or perl, I would like to know how to substitute a null character (0x00) for every white space without changing the white spaces inside the block of double quotes and the white space...
6,435
Posted By LessNux
How to call a bash command from within a perl script?
In a bash script, one can call a perl command in the following manner, where "myperlcommand" is a perl command.


perl -e 'myperlcommand(arguments)'

perl -e 'print("UUUU"x4)'




Now, how...
43,894
Posted By LessNux
nested logical expression in bash shell
Please tell me how to nest logical expressions in bash. I would like to nest logical expressions for arguments of the "test" command on bash.

The following pseudo-code shows my intention.


//...
4,581
Posted By LessNux
My BASH script was supposed to call a command...
My BASH script was supposed to call a command that takes file names (or pathnames). Suppose that the name of the command is TweakFile, and that its syntax is
TweakFile FILE...

After the perl...
Showing results 1 to 25 of 40

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