Search Results

Search: Posts Made By: pilnet101
7,736
Posted By pilnet101
You can try this, it is probably a lot more...
You can try this, it is probably a lot more complicated that in needs to be but it seems to work. It trims the leading spaces before \Start as well so if that is undesired then it can be changed.
...
2,820
Posted By pilnet101
awk diamond code golf (just for fun!)
Hey guys,

This is purely just a little bit of fun with awk. I realize this this isn't that constructive so please remove if need be.

Your goal:
Create a one line awk script that generates a...
1,168
Posted By pilnet101
Try: awk '($2>=10 && $2<=20) || ($3>=10 &&...
Try:

awk '($2>=10 && $2<=20) || ($3>=10 && $3<=20)' file

The following assumptions have been made based upon your output:
- If $2 OR $3 are within the min/max range, then print the row. Not $2...
2,888
Posted By pilnet101
Try: for fichier in fichier1 fichier2...
Try:

for fichier in fichier1 fichier2 fichier3; do
if [[ -e ${fichier} ]]; then
Pgsql
else
echo \nLe fichier ${fichier} n\'existe pas ;
fi
done
2,083
Posted By pilnet101
Another solution: printf "%s|%s\n" $(wc -l...
Another solution:

printf "%s|%s\n" $(wc -l file.txt asdf.txt lkjh.txt bvcx.txt|sed '$d') >> temp.txt
1,351
Posted By pilnet101
@Kanja No assumptions have been made - only...
@Kanja

No assumptions have been made - only answers based upon your input data/expected output
1,583
Posted By pilnet101
awk 'NR==FNR&&NR>1 # Whilst the condition...
awk 'NR==FNR&&NR>1 # Whilst the condition NR==FNR is true (which it will only be for the first file being read) and NR is greater than 1
{A[$2]=$NF;next}; # Build an array where the index is the...
1,583
Posted By pilnet101
Try: awk 'NR==FNR&&NR>1{A[$2]=$NF;next};($2...
Try:

awk 'NR==FNR&&NR>1{A[$2]=$NF;next};($2 in A){print $0,A[$2]}' file2 file1
1,744
Posted By pilnet101
What about a while loop? COUNTPRO2="gine is...
What about a while loop?

COUNTPRO2="gine is very bad
vine is pretty good"

echo "${COUNTPRO2}" | while read line; do
[[ $line == *"vine"* ]] && echo $line
done
1,202
Posted By pilnet101
Sorry about that, I've amended the script...
Sorry about that, I've amended the script slightly so it should work as expected now:

#!/bin/bash
FILESDIR=/home/cmccabe/Desktop/files
ANNOVARDIR=/home/cmccabe/Desktop/annovar

PS3="please...
1,202
Posted By pilnet101
Hi - This is only rough but something like the...
Hi - This is only rough but something like the below should work on your data:

#!/bin/bash
FILESDIR=/home/cmccabe/Desktop/files
ANNOVARDIR=/home/cmccabe/Desktop/annovar

PS3="please select a...
Forum: What is on Your Mind? 07-23-2016
2,169
Posted By pilnet101
Nice one Scrutinizer!!!
Nice one Scrutinizer!!!
7,275
Posted By pilnet101
$(basename $BASH_SOURCE) This will do what you...
$(basename $BASH_SOURCE) This will do what you want however, it is limited to the bash shell. If this is not a problem for you, feel free to use this if you want.
$0 This will display the full file...
7,275
Posted By pilnet101
Please use the code tags. If the script name...
Please use the code tags.

If the script name is fdmee_act_load.sh as it is mentioned in your comment, then no. The value of "${0##*/}" would be fdmee_act_load.sh. In order to strip the ".sh", you...
7,275
Posted By pilnet101
Yes exactly that should work as you expect. ...
Yes exactly that should work as you expect.

If you don't want to set the file name/use the temp variable, you can use the basename command which you mentioned in the original post. It will invoke...
1,399
Posted By pilnet101
So for number 1, by default the print command...
So for number 1, by default the print command within awk prints a new line at the end of the line it is printing. As the line here is blank (nothing enclosed within the quotes) it simply prints a...
4,936
Posted By pilnet101
Sure, So this part below will re-evaluate...
Sure,

So this part below will re-evaluate the value of $NF for every line read. The value of $NF being the last field.
awk '$NF=


For this part, ideally it should be enclosed in brackets....
4,936
Posted By pilnet101
As per the requirements, your current solution...
As per the requirements, your current solution does not always round up the last field. The below solution will always round up the last field:

echo "${NEWTEXTS}" | awk...
1,599
Posted By pilnet101
The only thing with that solution is that it will...
The only thing with that solution is that it will print multiple instances of the first column if there are missing sequences in different sections. For example, with the input of:
9999 10
9999 14...
2,983
Posted By pilnet101
You should really use a proper HTML parser tool...
You should really use a proper HTML parser tool for parsing HTML. If all your data is in the same format as your sample data, you can use the below simple awk command:

awk -F"[<>]" '{print...
Forum: AIX 05-25-2015
5,139
Posted By pilnet101
How do the files get into /log? Is it a manual...
How do the files get into /log? Is it a manual process or a script which is being run? In which case how is the script invoked: manually, batch scheduling etc.?

Once you know the answers to the...
2,113
Posted By pilnet101
Sam's solution works fine for me. None of the 4...
Sam's solution works fine for me. None of the 4 rows you have provided in your sample data will be printed as they contain no blanks except for in columns 6,8,9 which you want to exclude. Another awk...
6,583
Posted By pilnet101
Have a read up on "while loops" in shell...
Have a read up on "while loops" in shell scripting. This should achieve what you are after.
3,973
Posted By pilnet101
@sea You can use multi-dimensional arrays in...
@sea

You can use multi-dimensional arrays in bash, but it is a bit of a messy eval hack job
1,877
Posted By pilnet101
You can try: awk 'NF&&!/^C/{print ">"$0}'...
You can try:

awk 'NF&&!/^C/{print ">"$0}' ORS="" RS=">"
Showing results 1 to 25 of 61

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