Custom wget output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Custom wget output
# 1  
Old 04-30-2015
Custom wget output

The below hides the messy commands of wget

Code:
#!/bin/bash

cd 'C:\Users\cmccabe\Desktop\wget'
wget -O getCSV.txt http://172.24.188.113/data/getCSV.csv
    progressfilt ()
{
    local flag=false c count cr=$'\r' nl=$'\n'
    while IFS='' read -d '' -rn 1 c
    do
        if $flag
        then
            printf '%c' "$c"
        else
            if [[ $c != $cr && $c != $nl ]]
            then
                count=0
            else
                ((count++))
                if ((count > 1))
                then
                    flag=true
                fi
            fi
        fi
    done
}

output of the command:
Code:
--2015-04-30 14:12:45--  http://172.24.188.113/data/getCSV.csv
Connecting to 172.24.188.113:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/csv]
Saving to: 'getCSV.txt'

getCSV.txt              [ <=>                  ] 900.39K  --.-KB/s   in 0.03s

2015-04-30 14:12:48 (26.9 MB/s) - 'getCSV.txt' saved [921997]



What is the id of the NGS patient:

Is it possible to have:

Code:
Downloading file: 'getCSV.txt'

getCSV.txt              [ <=>                  ] 900.39K  --.-KB/s   in 0.03s

2015-04-30 14:12:48 (26.9 MB/s) - 'getCSV.txt' saved [921997]



What is the id of the NGS patient:

Thank you Smilie.

This is close with the text in bold missing (can they be added in the code):

Code:
 wget -O getCSV.txt http://xxx.xx.xxx.xxx/data/getCSV.csv --progress=bar:force 2>&1 | tail -f -n +6

Code:
Downloading file:
getCSV.txt              [ <=>                  ] 900.39K  --.-KB/s   in 0.02s

2015-04-30 14:26:58 (37.7 MB/s) - 'getCSV.txt' saved in C:\Users\cmccabe\Desktop\wget



What is the id of the NGS patient:


Last edited by cmccabe; 04-30-2015 at 04:29 PM..
# 2  
Old 04-30-2015
Filtering interactive things is always difficult. wget has something similar, however. Try wget -nv for less-verbose output which still has a progress bar -- much less messy.

Last edited by Corona688; 04-30-2015 at 04:35 PM..
# 3  
Old 04-30-2015
Is it possible to do something like this:

Code:
#!/bin/bash

cd 'C:\Users\cmccabe\Desktop\wget'
wget -O getCSV.txt http://xxx.xx.xxx.xxx/data/getCSV.csv

download() {
    local url=$1
    echo -n "    "
    wget --progress=dot $url 2>&1 | grep --line-buffered "%" | \
        sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}'
    echo -ne "\b\b\b\b"
    echo " DONE"
}

Output on screen:
Code:
Downloading: getCSV.csv: %

# 4  
Old 04-30-2015
wget -q --no-progress url

Fiddle with --progress= to fine tune it, see man wget.
This User Gave Thanks to Corona688 For This Post:
# 5  
Old 04-30-2015
Thank you Smilie.
# 6  
Old 04-30-2015
Er, typo. --show-progress, not --no-progress.
This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awking custom output

i have data that can look like this: echo "Master_Item_Service_is_down=0_njava_lang_NoClassDefFoundError=0_njava_lang_OutOfMemoryError=1_nemxCommonAppInitialization__Error_while_initializing=0_nINFO__Stopping_Coyote_HTTP_1_1_on_http_8080=7_nThe_file_or_directory_is_corrupted_and_unreadable=0_n" ... (7 Replies)
Discussion started by: SkySmart
7 Replies

2. Shell Programming and Scripting

Wget - working in browser but cannot download from wget

Hi, I need to download a zip file from my the below US govt link. https://www.sam.gov/SAMPortal/extractfiledownload?role=WW&version=SAM&filename=SAM_PUBLIC_MONTHLY_20160207.ZIP I only have wget utility installed on the server. When I use the below command, I am getting error 403... (2 Replies)
Discussion started by: Prasannag87
2 Replies

3. Shell Programming and Scripting

Encapsulating output of CURL and/or WGET

i use curl and wget quite often. i set up alarms on their output. for instance, i would run a "wget" on a url and then search for certain strings within the output given by the "wget". the problem is, i cant get the entire output or response of my wget/curl command to show up correctly in... (3 Replies)
Discussion started by: SkySmart
3 Replies

4. Shell Programming and Scripting

wget output file names

Hi, I have a list of urls in my input.txt file like this input.txt http://unix.com/index.html?acc=OSR765454&file=filename1.gz http://unix.com/index.html?acc=OBR765454&file=filename111.gz http://unix.com/index.html?acc=ORS765454&file=filename1111.gz... (12 Replies)
Discussion started by: jacobs.smith
12 Replies

5. Shell Programming and Scripting

Script to output custom characters in different order

Need a script to print a set of characters in different combination. What's the key to accomplish this. e.g charset: "Abcdefghij1" without quotes. block 1: "Abcd" block 2: "efg" block 3: "hij1" I need this script to change the order of the characters and print it to stdout e.g print out... (3 Replies)
Discussion started by: zaonline
3 Replies

6. Shell Programming and Scripting

ery weird wget/curl output - what should I do?

Hi, I'm trying to write a script to download RedHat's errata digest. It comes in a txt.gz format, and i can get it easily with firefox. HOWEVER: output is VERY strange when donwloading it in a script. It seems I'm getting a file of the same size - but partially text and partly binary! It... (5 Replies)
Discussion started by: jstilby
5 Replies

7. Shell Programming and Scripting

custom command

hi I am trying to make my own commands in my linux.I thought a command for changing directories will be easy. I made a simple file amd made the entries #!/bin/bash cd /opt/mydir I then made the file executable and then moved it to /usr/bin. But when i type the script name nothing... (2 Replies)
Discussion started by: born
2 Replies

8. Red Hat

Custom output on FIND

I have a file, ENV.doc somewhere in my home directory. I want to know where the file is located in my sub directories using FIND. But, I want to display only the relative path along with the file name. Thanks, (6 Replies)
Discussion started by: ashok.g
6 Replies

9. HP-UX

Output of Custom package scripts to terminal

Hi, I am doing some testing with creation of depots on HP-UX systems (11.11). Want to display some echo statements based on the processing during checkinstall, pre & postinstall scripts on the terminal. The echo statements are getting directed to /var/adm/sw/swagent.log I want to display... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

10. UNIX for Dummies Questions & Answers

wget output question

Hello there, İ want to ask a very simple question. I want to read the output messages of wget both in terminal and also put them into a text file. i know that by using -o flag, i can log the messages into a text file but then i won't be able to see them on terminal. I'd appreciate any help... (1 Reply)
Discussion started by: sertansenturk
1 Replies
Login or Register to Ask a Question