Search Results

Search: Posts Made By: pilnet101
9,655
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,497
Posted By pilnet101
set is a shell built in. It can be used to define...
set is a shell built in. It can be used to define environmental variables however in this instance it is being used to evaluate positional parameters based upon what * expands to. For example, if *...
3,106
Posted By pilnet101
Thanks for all the great replies guys. I enjoyed...
Thanks for all the great replies guys. I enjoyed playing about with your script Don!

You can turn this into a little 'find the hidden character' type game to. For example, find the hidden $ in a...
3,106
Posted By pilnet101
Wow Scrutinizer, very nice! Now I have to try and...
Wow Scrutinizer, very nice! Now I have to try and get my head round your code :)
3,106
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...
2,725
Posted By pilnet101
What have you tried so far? Can you provide some...
What have you tried so far? Can you provide some sample input data/desired output data?
2,174
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...
4,016
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
3,906
Posted By pilnet101
Depending on your shell you could do something...
Depending on your shell you could do something like:

echo ${line/*[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-3][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9],[0-9][0-9][0-9]/}
3,015
Posted By pilnet101
Try: awk...
Try:

awk 'f{gsub(/[[:lower:]]/,toupper($0));f=0};NF{f=1}1' file
2,587
Posted By pilnet101
Thanks Akshay - Amended now!
Thanks Akshay - Amended now!
2,587
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
2,587
Posted By pilnet101
Try: awk 'FNR==1&&p{print...
Try:

awk 'FNR==1&&p{print p};{p=FNR"|"FILENAME};END{print FNR"|" FILENAME}' file.txt asdf.txt lkjh.txt bvcx.txt >> temp.txt
1,545
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
2,167
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...
2,167
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
3,300
Posted By pilnet101
In the 2nd column of your 2nd line you have the...
In the 2nd column of your 2nd line you have the number 269. In your output you have got 265, shouldn't this be 268?

The below is a pure shell solution:

f=0 ; while read -r one two three; do
...
2,485
Posted By pilnet101
Can you also post the expected output please?
Can you also post the expected output please?
2,460
Posted By pilnet101
I am seeing it also
I am seeing it also
2,193
Posted By pilnet101
It would all depend upon the number of lines the...
It would all depend upon the number of lines the code is traversing.
2,193
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,518
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...
Forum: What is on Your Mind? 07-23-2016
3,482
Posted By pilnet101
Nice one Scrutinizer!!!
Nice one Scrutinizer!!!
1,518
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...
4,529
Posted By pilnet101
That method is quite an overkill by the looks of...
That method is quite an overkill by the looks of it. You could simply do something like this (providing you have an bash/ksh that supports this form of parameter expansion):


fs="/one/two/three/"...
Showing results 1 to 25 of 173

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