Visit Our UNIX and Linux User Community

Top Forums UNIX for Dummies Questions & Answers Creating a one liner with wget, grep and mv Post 302337469 by figaro on Friday 24th of July 2009 08:01:46 AM
Old 07-24-2009
Creating a one liner with wget, grep and mv

I have the following simplified script, that consists of a download (wget), a grab of only the lines with a comma (grep) and a rename of the file to indicate its date of origin (mv):
grep ',' datafile.csv
mv datafile.csv datafile.`date +"%Y%m%d%H%M%S"`.csv

However, what i really want to do is create a one liner, such that I am not dependent on file names, but simply treat the downloaded file as one object. Hence, I need something like this:
wget | grep ',' > datafile.`date +"%Y%m%d%H%M%S"`.csv

How do I create a one liner for this? Thanks in advance
Test Your Knowledge in Computers #409
Difficulty: Medium
XENIX is a discontinued version of the UNIX operating system for various microcomputer platforms, licensed by Microsoft from AT&T Corporation in the late 1970s.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep/Awk WGet Time

I am trying to grep/awk how long it takes to get a page. I am trying to use the following command. time -p wget -q -O wget.tmp 2>&1 | grep realThe problem is that my attempts to map stderr to stdout are being applied to wget not to time so all of the time output is displayed on... (2 Replies)
Discussion started by: wstrater
2 Replies

2. Shell Programming and Scripting

creating a csv file from this 1 liner?

I'm trying to create a csv file by running awk and sed on a number of xml files in a directory; I'm using this below: hostname; grep "BuildDate" /dir/ABCD/configuration/*/*.xml | awk -F"/" '{ print $5 }' > /tmp/tempfile.txt; grep "BuildDate" /dir/ABCD/configuration/*/*.xml | awk -F\" '{ print $2... (2 Replies)
Discussion started by: rich@ardz
2 Replies

3. Shell Programming and Scripting

grep-awk one liner help

Hi guys, I'm trying to create a one line command that does the following. I will post my command first so you can get the idea better: ls -larht | awk '{print $4}' | uniq | xargs grep * __________ ls -larht | awk '{print $4}' | uniq This will post the name of the groups of each file... (2 Replies)
Discussion started by: erick_tuk
2 Replies

4. Shell Programming and Scripting

Search & Replace regex Perl one liner to AWK one liner

Thanks for giving your time and effort to answer questions and helping newbies like me understand awk. I have a huge file, millions of lines, so perl takes quite a bit of time, I'd like to convert these perl one liners to awk. Basically I'd like all lines with ISA sandwiched between... (9 Replies)
Discussion started by: verge
9 Replies

5. UNIX for Dummies Questions & Answers

One liner pattern search with awk/sed/grep

I have an array containing bunch of characters. I have to check this array for specific character and if "Not Found than" use a goto statement to go to USAGE set options = (A B C D E F) @ i = 0 while ($i <= ${#options}) if ($options != "F" || $options != "D") then goto USAGE endif @... (1 Reply)
Discussion started by: dixits
1 Replies

6. Shell Programming and Scripting

need a one liner to grep a group info from /etc/group and use that result to search passwd file

/etc/group tiadm::345:mk789,po312,jo343,ju454,ko453,yx879,iy345,hn453 bin::2:root,daemon sys::3:root,bin,adm adm::4:root,daemon uucp::5:root /etc/passwd mk789:x:234:1::/export/home/dummy:/bin/sh po312:x:234:1::/export/home/dummy:/bin/sh ju454:x:234:1::/export/home/dummy:/bin/sh... (6 Replies)
Discussion started by: chidori
6 Replies

7. UNIX for Dummies Questions & Answers

Creating a loop to go through grep output

I'm doing this script in my Unix class and I've come to a roadblock. The purpose of this script is to search users directories for files that contain bad words i.e kill murder bomb etc., and then be able to ignore legitimate files with each use. I got the searching and ignoring part down but now... (1 Reply)
Discussion started by: jrod44
1 Replies

8. OS X (Apple)

Having trouble creating an alias for grep

Hi, I'm using Mac 10.9.1. I would like to create an alias for grep so that it won't print out messages like "grep: /Users/davea/workspace/myproject/subdir/: Is a directory" all the time. So in my terminal, I opened ~/.profile and entered alias grep='grep -s' However, when I close and... (5 Replies)
Discussion started by: laredotornado
5 Replies

9. 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. 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

10. UNIX for Beginners Questions & Answers

Wget, grep, sort, sed in 1 command/script

Hi, I need to join these statements for efficiency, and without having to make a new directory for each batch. I'm annotating commands below. wget -q -r -l1 URL ^^ can't use -O - here and pipe | to grep because of -r grep -hrio "\b\+@\+\.\{2,4\}\+\b" * > first.txt ^^ Need to grep the output... (14 Replies)
Discussion started by: p1ne
14 Replies
Xmark(1)						      General Commands Manual							  Xmark(1)

Xmark - summarize x11perf results SYNTAX
Xmark datafile DESCRIPTION
Xmark is a shell script that reads the indicated datafile and compiles a benchmark which it writes to standard output. It writes three numbers: A weighted performance number for the x11perf results. A weighted performance number for a standard SparcStation 1, with SunOS 4.1.2, X11R5 Xsun, and a CG3 dumb Color Frame Buffer. The Xmark, which is the ratio of the two numbers above. The datafile must be an ordinary file, produced by x11perf in the following way: x11perf -display display -v1.3 -rop GXcopy GXxor -all > datafile It is possible to run the GXcopy and GXxor tests separately, as long as they are concatenated to the same output file: x11perf -display display -v1.3 -rop GXcopy -all > datafile x11perf -display display -v1.3 -rop GXxor -all >> datafile or x11perf -display display -v1.3 -rop GXxor -all > datafile x11perf -display display -v1.3 -rop GXcopy -all >> datafile FILES
temp.$$ Temporary file created in the current directory, deleted after use. DIAGNOSTICS
Usage: Xmark datafile Xmark was invoked without arguments or with more than one argument, or with options. Xmark takes no options. Error: data file does not exist or is not ordinary. Xmark cannot find the datafile named on its command line, or the datafile is a special file such as a directory. WARNING: datafile contains nnn, not 441 or 447 'trep' results; The file named on the command line does not seem to be a file generated by x11perf in the expected way. Diagnostic: ERROR: sum of weights =nnn, not equal to 4566.0; There is an internal error in Xmark. SEE ALSO
X(7), x11perf(1), x11perfcomp(1) X Version 11 x11perf 1.5.1 Xmark(1)

Featured Tech Videos

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