11-02-2010
Awk command to split file name
Hi
I have few files with format access.2Nov-12:15AM.
These files will be generated daily . I need to write a script so that if today's date is less than 10 then it has to zip the file and rename it to
acess.02Nov-12:15AM.gz .please help me in this . Also please help me
in splitting the file acess.2Nov-12:15AM to
1 acess
2 2
3 Nov
4 12:15
5 AM
Thanks for the help in advance
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a problem in grepping a file for 2 strings and writing them to 2 appropriate files. I need to use the awk command and read the file only once and write to the appropriate file.
My file is very huge in size and it is taking a long time using cat command and grep command.
Can anyone... (3 Replies)
Discussion started by: m_subra_mani
3 Replies
2. UNIX for Dummies Questions & Answers
I have gone through all the threads in the forum and tested out different things. I am trying to split a 3GB file into multiple files. Some files are even larger than this.
For example:
split -l 3000000 filename.txt
This is very slow and it splits the file with 3 million records in each... (10 Replies)
Discussion started by: madhunk
10 Replies
3. Shell Programming and Scripting
Hi all,
I'm pretty new to Shell scripting and I need some help to split a source text file into multiple files. The source has a row with pattern where the file needs to be split, and the pattern row also contains the file name of the destination for that specific piece. Here is an example:
... (2 Replies)
Discussion started by: cul8er
2 Replies
4. Shell Programming and Scripting
Hi,
I have an array with following data. First field shows the owner and second is unique name. Now i have to pic the latest value with respect to the date in case of duplicate.
like "def" is from two owners "rahul/vineet", now i want the latest from the two and the owner name also for all the... (9 Replies)
Discussion started by: vineet.dhingra
9 Replies
5. Shell Programming and Scripting
awk 'FNR == 1 { c = 1 } { print > (f c) } !FNR%n { close(f c); ++c }' n=$files_per_stream f=$input_path/filename_ $input_file
$input_file with some records are splitted into files named filename_1,filename_2...etc according to $files_per_stream.
Plz help me know how and if anyone has... (7 Replies)
Discussion started by: guptam
7 Replies
6. Shell Programming and Scripting
Hi,
There is an awk command in script and it is running successfully.
I want to split that command in 2 lines.
I have tried using '\' but its not working..
Please suggest me the solution. (11 Replies)
Discussion started by: Sanket Dalvi
11 Replies
7. Shell Programming and Scripting
Hi all,
First of all I' like to mention that I'm pretty new to unix scripting. :(
I'm trying to split an large xml with awk and rename it based on the values of two attributes.
Example XML
<RECORD>
<element1>11</element1>
<element2>22</element2>
<element3>33</element3>... (18 Replies)
Discussion started by: f0usk4s
18 Replies
8. Shell Programming and Scripting
Dear all,
I am using the awk 'split' command to get the particular value.
FILE=InputFile_009_0.txt
Temp=$(echo $FILE | awk '{split($FILE, a, "e_"); print a}')
I would like to have the Temp take the value as : _009_0
... (4 Replies)
Discussion started by: emily
4 Replies
9. Shell Programming and Scripting
I am trying to run the awk below. My question is when I split the input, then run anotherawk to perform a calculation using that splitas the input there are no issues. When I try to combine them the output is not correct, is the split not working or did I do it wrong? Thank you :).
input
... (8 Replies)
Discussion started by: cmccabe
8 Replies
10. UNIX for Beginners Questions & Answers
Hello,
I need to split a pipe de-limited file based on the COLUMN 7 value . If the column value changes I need to split the file
Source File
Payment|ID|DATE|TIME|CONTROLNUMBER|NUMBER|NAME|INDICATOR
42156974|1137937|10/1/2018|104440|4232|2054391|CARE|1... (9 Replies)
Discussion started by: rosebud123
9 Replies
LEARN ABOUT DEBIAN
podget
podget.man(7) Linux Reference Manual podget.man(7)
NAME
Podget
SYNOPSIS
podget <options> [command]
podget -h | --help
DESCRIPTION
OPTIONS
-c, --config <FILE>
Name of configuration file.
-C, --cleanup
Skip downloading and only run cleanup loop.
--cleanup_days <NUMBER>
Cleanup files older than <NUMBER> days.
--cleanup_simulate
Simulate cleanup loop to see what files would be deleted.
-d, --dir_config <DIRECTORY>
Directory that configuration files are stored in.
-f, --force
Force download of items from each feed even if they've already been downloaded.
--import_opml <FILE or URL>
Import servers from OPML file or HTTP/FTP URL.
--import_pcast <FILE or URL>
Import server from iTunes PCAST file or HTTP/FTP URL.
-l, --library <DIRECTORY>
Directory to store downloaded files in.
-p, --playlist-asx
In addition to M3U playlists, create ASX playlists.
-r, --recent <COUNT>
Download only the <COUNT> newest items from each feed.
--serverlist <FILE>
Use <FILE> as serverlist instead of default.
-s, --silent
Run silently (for cron jobs).
-v Set verbosity to level 1.
--verbosity <LEVEL>
Set verbosity level (0-3).
-h, --help
Display help.
EXAMPLE CRON JOB
Once podget is running acceptably, its most useful if you run it from a cron job so that the new songs are available to play or load onto a
portable player and you dont have to wait for them to download.
To edit your crontab, do:
$ crontab -e
Then insert one line (i for insert mode), like the following:
15 04 * * * /usr/bin/podget -s
This will run podget at 4:15 AM every day.
AUTOMATIC CLEANUP
You can enabled automatic cleanup with every run by configuring it in your $HOME/.podget/podgetrc file. Simply set the following options:
# Autocleanup.
# 0 == disabled
# 1 == delete any old content
cleanup=1
# Number of days to keep files. Cleanup will remove anything
# older than this.
cleanup_days=7
However, some people prefer to run cleanup as a seperate cron session. To do that, set the options in .podgetrc to:
# Autocleanup.
# 0 == disabled
# 1 == delete any old content
cleanup=0
# Number of days to keep files. Cleanup will remove anything
# older than this.
cleanup_days=7
And add a cron job to run cleanup, like one of these examples:
# Once a week on Sunday at 04:15AM
15 04 * * Sun /usr/bin/podget -C
SESSION CONTROL
Podget checks for already running sessions when it starts and exits if any are found.
Each session requires its own core configuration file, so for multiple sessions simply provide a unique -c <configfile> option for
each.
EXAMPLE SERVER LIST
By default, Podget uses $HOME/.podget/serverlist for the default list of servers
to contact.
However you can configure the name with the config_serverlist variable in your $HOME/.podget/podgetrc file.
The default format is: <url> <category> <name>
Note: Category must be one word.
Example:
# Default Server List for podget
# FORMAT: <url> <category> <name>
# NOTE: Category must be one word
http://www.distortedview.com/show/index.xml Humor Distorted View
http://www.podcastingnews.com/forum/links.php?func=show&id=214 IT In the Trenches
http://www.lugradio.org/episodes.rss Linux LUG Radio
http://thelinuxlink.net/tllts/tllts.rss Linux The Linux Link
http://www.bbc.co.uk/radio4/history/inourtime/mp3/podcast.xml Philosophy BBC: In Our Time
http://www.privacyfreaks.org/podcast.php privacy Privacy Freaks
http://www.rsasecurity.com/blog/rssfeed.asp security Speaking of Security
http://dl.chickencat.com/podcast.php privacy Digital Liberties
http://feeds.feedburner.com/LiveAmmo security LiveAmmo
HANDLING UTF-16 FEEDS
Some servers provide their feeds in UTF-16 format rather than the more common UTF-8.
To automatically convert these files, create a secondary serverlist at:
$HOME/.podget/serverlist.utf16
Remember to change the name of the serverlist to match what you set it to with config_serverlist if you changed it.
AUTHORS
Dave Vehrs
DOC
January 06, 2007 podget.man(7)