Search Results

Search: Posts Made By: sudo
1,941
Posted By Chubler_XL
how about this: awk ' BEGIN { ...
how about this:

awk '
BEGIN {
split("PROD INFO DATE HEADER", tag)
split("product info date header", holder)
}
FNR==NR {
for(i in tag) {
if(index($0, tag[i]"START"))...
2,099
Posted By vbe
Using case statement?
Using case statement?
1,482
Posted By Don Cragun
Note that in the 1st post in this thread, sudo...
Note that in the 1st post in this thread, sudo said "I am having trouble matching multiple strings within an instanza. I ONLY want it to print if it finds both strings within the range. Example input...
1,482
Posted By Aia
awk '$2 ~ /artist/ && $4 ~ /play count/ {print $2...
awk '$2 ~ /artist/ && $4 ~ /play count/ {print $2 FS $4}' FS="\n" RS= inputfile
1,482
Posted By Don Cragun
sudo, You could also try something like: awk...
sudo,
You could also try something like:
awk '
/^artist:/ { a = $0 }
/^play count:/ { p = $0 }
/^endgroup/ {
if(a != "" && p != "") {
print a
print p
...
1,482
Posted By sea
How about: PLAY=30 ARTIST=beethoven grep...
How about:
PLAY=30
ARTIST=beethoven
grep -A3 $ARTIST input_file | grep -B3 $PLAY

EDIT:
Read again your post and figured you wanted the occourence of play, and not the played 30...
In that...
1,482
Posted By RavinderSingh13
Hello sudo, Following may help in same. ...
Hello sudo,

Following may help in same.


awk '/startgroup/ {A=1} {if(A){if($0 ~ /artist/){S=$0;} if($0 ~ /play count/){print S ORS $0}}} /endgroup/ {A=0}' Input_file


Output will be as...
1,482
Posted By RudiC
Depending on the script complexity, a simple ssh...
Depending on the script complexity, a simple ssh user@host cat script.sh | sh might be sufficient.
1,482
Posted By sea
This said, you could also package it according to...
This said, you could also package it according to your package manager.

As in, TUI (Text User Interface) is actualy a bash based project, and since my linux is fedora, i have it packated as an...
1,482
Posted By Chubler_XL
Yes depending on how frequently you expect it to...
Yes depending on how frequently you expect it to change. One could use a daily/hourly cron job to check for updates, or always fetch it and execute as you go.

I would be careful if the script is...
1,482
Posted By sea
How about you pass an 'execution' script to the...
How about you pass an 'execution' script to the users, which does similar things like Chubler_XL suggested.
But basicly, it will just download your real script and execute it.
1,482
Posted By Chubler_XL
Yes you can use wget to fetch the script from a...
Yes you can use wget to fetch the script from a server to the local system as long as your firewall will allow the local system to http:// (port 80) browse to the server in question.

wget...
2,392
Posted By Scrutinizer
You are using the script with sh scriptInstead...
You are using the script with sh scriptInstead use bash script



... or make the script executable and and call it directly.
/path/to/script

Then the shebang (the #! characters on the first...
1,095
Posted By Corona688
This is not obvious when you post an example...
This is not obvious when you post an example containing one and exactly one array used directly.

What do you mean by 'call independently'? Are you trying to make an array-full-of-arrays kind of...
1,095
Posted By Corona688
Yes, that is a good idea for combining arrays --...
Yes, that is a good idea for combining arrays -- pass them all into the function as arguments, they will be available as "$@".
1,095
Posted By sea
Try: array=( /Library/Application\ Support/ ...
Try:
array=(
/Library/Application\ Support/
/Library/LaunchAgents/folder_that_doesnt_exist
)
results ()
{
for i in "${@}" ; do
if [[ -e "$i" ]]; then
echo "**Found**:...
1,095
Posted By Corona688
Use "${array[@]}" not "@{!array[@]} Also,...
Use "${array[@]}" not "@{!array[@]}

Also, for does not work that way. i becomes a string, not a number index.

Also, you can put a ! in the expression instead of an empty 'if'.

for i in...
2,463
Posted By RudiC
Would be a perfect candidate for the select ...
Would be a perfect candidate for the select (bash/ksh) builtin:select CHOICE in $(find ... ); do echo $CHOICE; done, if available on your system...
2,463
Posted By Don Cragun
Maybe you can find something useful in this...
Maybe you can find something useful in this example:
#!/bin/ksh
IAm=${0##*/}
tf="/tmp/$IAm.$$"
trap 'rm -f "$tf"' EXIT
find . -type f > "$tf"
nl "$tf"
printf 'Enter number of file to process...
1,014
Posted By Chubler_XL
Try downloading the application called...
Try downloading the application called GetMyDN.exe in domain to get your own Distinguished Name. Then the last part before the "User Accounts" or such is you value you want to start your ldapsearch...
1,014
Posted By Chubler_XL
You will need to browse AD and find the correct...
You will need to browse AD and find the correct OU and DC plus the fields you are interested most organisations will populate OU and different fields so this is usually the biggest hurdle

Here is...
1,540
Posted By Aia
In any case it is much safer to get used to...
In any case it is much safer to get used to double quote any variable and to add ${} when a variable is combined with other strings

example:

cp "$FILEPATH" "${DESTINATION}"/"${COUNTRY}"

Let...
1,540
Posted By Corona688
The funny thing is, I added -r to avoid these...
The funny thing is, I added -r to avoid these problems, since handling backslashes is generally an unexpected thing for read to do.

Remove the -r and read should convert the "\ " into " "
1,540
Posted By Aia
Then just collect the user answer into a variable...
Then just collect the user answer into a variable inputfile

while IFS="," read -r FILEPATH COUNTRY
do
echo $FILEPATH $COUNTRY
done < $inputfile
1,540
Posted By Corona688
'read' does not take a file name, it takes one or...
'read' does not take a file name, it takes one or more variable names (If more than one is given, it splits based on the IFS variable). Data is fed into the loop through redirection.

while...
Showing results 1 to 25 of 62

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