Sponsored Content
Homework and Emergencies Homework & Coursework Questions How to use xargs to repeat as a loop to grab date string? Post 302926473 by scopiop on Monday 24th of November 2014 03:51:47 PM
Old 11-24-2014
How to use xargs to repeat as a loop to grab date string?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
My goal to find how many requests in 14 days from weblog server. I know to cat a weblog file to wc -l to find the total of all requests have send to server. From there on, I can use a loop of 14 days to go through each line and do comparison with Date String until the string are different I would increment the date until it reach 14th date. I was thinking to seq 14 and xargs commands to go through 14 days cycle.
I would like to know how to do a string compare between date?

Thanks in advance,

Scopiop

2. Relevant commands, code, scripts, algorithms:
Code:
192.192.1.1 - - [10/June/2013...]
192.192.1.2 - - [10/June/2013...]
192.192.1.3 - - [11/June/2013..]
192.192.1.4 - - [12/June/2013..]
........

output
Code:
The last 14 day's requests are: 100


3. The attempts at a solution (include all code and scripts):

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
City College/Aaron Brick/160B

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String substitution on find results inside exec/xargs

What I'm trying to do is perform a copy, well a ditto actually, on the results of a find command, but some inline string substitution needs to happen. So if I run this code find ./ -name "*.tif" I get back these results. .//1234567.tif .//abcdefg.tif Now the action from exec or xargs I... (2 Replies)
Discussion started by: myndcraft
2 Replies

2. Shell Programming and Scripting

case loop... repeat on bad input?

I'm trying to get a case statement to start over if an undefined option is selected... But I am ata loss on how to actually do it. Here is a quick example of what I have. Echo "1) do this/n 2) Do that/n 3) Quit/n Make a selection/n" Read answer Case answer in 1) Dothid;; 2) Dothat;;... (3 Replies)
Discussion started by: trey85stang
3 Replies

3. Homework & Coursework Questions

Date comparison with 'string date having slashes and time zone' in Bash only

1. The problem statement, all variables and given/known data: I have standard web server log file. It contains different columns (like IP address, request result code, request type etc) including a date column with the format . I have developed a log analysis command line utility that displays... (1 Reply)
Discussion started by: TariqYousaf
1 Replies

4. Shell Programming and Scripting

Grab first or second line after a search string

In a shell script, I need to grab the first or second line after a search string in a file. For example: File.out: Random Info Manufacturer: XYZPDQ System Info Manufacturer: Hewlett-Packard Product Name: ProLiant I search for the word FILE, I want to be able to grab the line... (1 Reply)
Discussion started by: jwk1230
1 Replies

5. Shell Programming and Scripting

Matching 2 chars of a string that repeat

Hello Unix gurus, I have a gzipped file where each line contains 2 street addresses in the US. What I want to do is get a count for each state that does not match. What I have so far is: $ gzcat matched_10_09.txt.gz |cut -c 106-107,184-185 | head -5 CTCT CTNY CTCT CTFL CTMA This cuts... (5 Replies)
Discussion started by: sitney
5 Replies

6. Shell Programming and Scripting

Repeat using for loop

I have a file like this 2011-10-10 10:46:00,1-1-13-1-1,151510,ALCLA0A84D2C 2011-10-10 10:46:00,1-1-13-1-1,151520,65537 2011-10-10 10:46:00,1-1-13-1-1,151515,46932 2011-10-10 10:46:00,1-1-13-1-1,151521,32769 2011-10-10 10:46:00,1-1-13-1-1,151522,32769 2011-10-10... (4 Replies)
Discussion started by: LavanyaP
4 Replies

7. Shell Programming and Scripting

Replace string, grab files, rename and move

Hello there! I'm having a lot of trouble writing a script. The script is supposed to: 1) Find all files with the name "Object.mtl" within each folder in the directory: /Users/username/Desktop/convert/Objects 2) Search and replace the string ".bmp" with ".tif" (without the quotations) 3)... (1 Reply)
Discussion started by: Blue Solo
1 Replies

8. Homework & Coursework Questions

How to use loop to repeat task?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. How can i use loop to repeat task. 2.shirt=15 black=13.50 echo "how many shirt you want" read num echo echo "Please enter a choice" echo "1 ---> normal... (5 Replies)
Discussion started by: Tauatioti
5 Replies

9. Shell Programming and Scripting

Single parse to grab two chunks of string

Hi all, I'm struggling with this task and have done alot of googling but not found the solution or atleast not found a way to combine them, i'm hoping someone here can help me out. I have a file that contains many line of config "below is two lines for an example" 323 => 1111,Terry berry... (3 Replies)
Discussion started by: 3sparky
3 Replies

10. Shell Programming and Scripting

Perl to adjust coordinates based on repeat string

In the file below I am trying to count the given repeats of A,T,C,G in each string of letters. Each sequence is below the > and it is possible for a string of repeats to wrap from the line above. For example, in the first line the last letter is a T and the next lines has 3 more. I think the below... (10 Replies)
Discussion started by: cmccabe
10 Replies
tartrc(5)						LinuxTaRT configuration file format						 tartrc(5)

NAME
.tartrc - Configuration file for LinuxTaRT DESCRIPTION
LinuxTaRT uses a configuration file called tartrc. This configuration file is searched for in the following location: ~/.tartrc PARAMETERS
CustomText1 = string Signature header or text to replace %c1 in template. CustomText2 = string Signature footer or text to replace %c2 in template. SignatureFile = /path/to/signature_file Location and name file to write the sigature to. TagLineDatabase = /path/to/tagline_database Location and name of tagline database. (defaults to /etc/tart.tags) SpecialDates = /path/to/special_dates Location and name of special date file. CustomFile = /path/to/template Location and name of layout template. The following settings may be overridden from the command line. RunQuiet = 0|1 Display information during executution. ShowDate = 0|1 Display the date in the default signature. ShowVersion = 0|1 Display the LinuxTaRT version in the default signature. CenterText = 0|1 Center the text in the default signature. UseCustomText = 0|1 Generate signature from template or use default layout. UseSpecialDates = 0|1 Check special date file for special dates. RunAsDaemon = seconds Run as a daemon and wait this many seconds between updates. FILES
~/.tartrc SEE ALSO
tart(1) tartdates(5) tart-custom(5) Mark Veinot 1.0.0 tartrc(5)
All times are GMT -4. The time now is 04:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy