04-11-2006
hi
try this
ls -lg | awk '//
{
if(length($7)==4)
{
print $8,$7
}
else
{
print $8, system("date +%Y")
}
}'
it will prints file name and year - if exists otherwise it will print
file name and current year.
it also returns ls -lg output i dont know how to avoid that
might be someone from foroum willhelp us
regards,
swapneel
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear friends,
please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories..
it is like this,
current directory contains
file1, file2, file3, dir1, dir2
and dir1 conatins
file4, file5
and dir2 contains
file6,... (9 Replies)
Discussion started by: swamymns
9 Replies
2. UNIX for Advanced & Expert Users
Hey all,
I have a shell that invokes a AWK.
In this AWK i want invoke a function that receives 3 parameters:
date: 20080831
time: 235901
duration: 00023
that function receive this 3 parameters and sum to this value two more seconds:
2008083123590100025
Remember that in case that... (3 Replies)
Discussion started by: anaconga
3 Replies
3. Shell Programming and Scripting
Dear friends, following is the output of a script from which I want to remove spaces and new-line characters.
Example:-
Line1 abcdefghijklmnopqrstuvwxyz
Line2 mnopqrstuvwxyzabcdefghijkl
Line3 opqrstuvwxyzabcdefdefg
Here in above example, at every starting line there is a “tab” &... (4 Replies)
Discussion started by: anushree.a
4 Replies
4. UNIX for Advanced & Expert Users
I have three files a.txt , b.txt , c.txt in a directory called my_dir1 .These files were created before two or three months . I have a tar file called my_tar1.tar which contains three files a.txt , b.txt , d.txt . Somebody untarred the my_tar1.tar into my_dir1 directory. So existing two files were... (1 Reply)
Discussion started by: joe.mani
1 Replies
5. Shell Programming and Scripting
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Discussion started by: shis100
7 Replies
6. Shell Programming and Scripting
I want to list all files/lines which except those which contain the pattern ' /proc/' OR ' /sys/' (mind the leading blank).
In a first approach I coded:
find / -exec ls -ld {} | grep -v ' /proc/| /sys/' \; > /tmp/list.txt
But this doesn't work. I got an error (under Ubuntu):
grep:... (5 Replies)
Discussion started by: pstein
5 Replies
7. Shell Programming and Scripting
Hi Guys,
I am working in ksh88 and need the output of "ps -ef" command to give me the exact match of my pattern, for example:
$ ps -ef 'gen_sub'
UID PID PPID NLWP PGID SID STIME TIME COMMAND
op 9209 8249 1 9209 9209 14:52:57 00:00 /usr/bin/ksh... (3 Replies)
Discussion started by: aoussenko
3 Replies
8. Shell Programming and Scripting
I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies
9. UNIX for Dummies Questions & Answers
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies
10. AIX
Hi 2 all,
i have had AIX 7.2
:/# /usr/IBMAHS/bin/apachectl -v
Server version: Apache/2.4.12 (Unix)
Server built: May 25 2015 04:58:27
:/#:/# /usr/IBMAHS/bin/apachectl -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_worker_module (static)
... (3 Replies)
Discussion started by: penchev
3 Replies
LEARN ABOUT DEBIAN
mp3::tag::id3v1
MP3::Tag::ID3v1(3pm) User Contributed Perl Documentation MP3::Tag::ID3v1(3pm)
NAME
MP3::Tag::ID3v1 - Module for reading / writing ID3v1 tags of MP3 audio files
SYNOPSIS
MP3::Tag::ID3v1 is designed to be called from the MP3::Tag module.
use MP3::Tag;
$mp3 = MP3::Tag->new($filename);
# read an existing tag
$mp3->get_tags();
$id3v1 = $mp3->{ID3v1} if exists $mp3->{ID3v1};
# or create a new tag
$id3v1 = $mp3->new_tag("ID3v1");
See MP3::Tag for information on the above used functions.
* Reading the tag
print " Title: " .$id3v1->title . "
";
print " Artist: " .$id3v1->artist . "
";
print " Album: " .$id3v1->album . "
";
print "Comment: " .$id3v1->comment . "
";
print " Year: " .$id3v1->year . "
";
print " Genre: " .$id3v1->genre . "
";
print " Track: " .$id3v1->track . "
";
# or at once
@tagdata = $mp3->all();
foreach $tag (@tagdata) {
print $tag;
}
* Changing / Writing the tag
$id3v1->comment("This is only a Test Tag");
$id3v1->title("testing");
$id3v1->artist("Artest");
$id3v1->album("Test it");
$id3v1->year("1965");
$id3v1->track("5");
$id3v1->genre("Blues");
# or at once
$id3v1->all("song title","artist","album","1900","comment",10,"Ska");
$id3v1->write_tag();
* Removing the tag from the file
$id3v1->remove_tag();
AUTHOR
Thomas Geffert, thg@users.sourceforge.net
DESCRIPTION
title(), artist(), album(), year(), comment(), track(), genre()
$artist = $id3v1->artist;
$artist = $id3v1->artist($artist);
$album = $id3v1->album;
$album = $id3v1->album($album);
$year = $id3v1->year;
$year = $id3v1->year($year);
$comment = $id3v1->comment;
$comment = $id3v1->comment($comment);
$track = $id3v1->track;
$track = $id3v1->track($track);
$genre = $id3v1->genre;
$genre = $id3v1->genre($genre);
Use these functions to retrieve the date of these fields, or to set the data.
$genre can be a string with the name of the genre, or a number describing the genre.
all()
@tagdata = $id3v1->all;
@tagdata = $id3v1->all($title, $artist, $album, $year, $comment, $track, $genre);
Returns all information of the tag in a list. You can use this sub also to set the data of the complete tag.
The order of the data is always title, artist, album, year, comment, track, and genre. genre has to be a string with the name of the
genre, or a number identifying the genre.
fits_tag()
warn "data truncated" unless $id3v1->fits_tag($hash);
Check whether the info in ID3v1 tag fits into the format of the file.
as_bin()
$str = $id3v1->as_bin();
Returns the ID3v1 tag as a string.
write_tag()
$id3v1->write_tag();
[old name: writeTag() . The old name is still available, but you should use the new name]
Writes the ID3v1 tag to the file.
remove_tag()
$id3v1->remove_tag();
Removes the ID3v1 tag from the file. Returns negative on failure, FALSE if no tag was found.
(Caveat: only one tag is removed; some - broken - files may have many chain-loaded one after another; you may need to call remove_tag()
in a loop to handle such beasts.)
[old name: removeTag() . The old name is still available, but you should use the new name]
genres()
@allgenres = $id3v1->genres;
$genreName = $id3v1->genres($genreID);
$genreID = $id3v1->genres($genreName);
Returns a list of all genres, or the according name or id to a given id or name.
new()
$id3v1 = MP3::Tag::ID3v1->new($mp3fileobj[, $create]);
Generally called from MP3::Tag, because a $mp3fileobj is needed. If $create is true, a new tag is created. Otherwise undef is
returned, if now ID3v1 tag is found in the $mp3obj.
Please use
$mp3 = MP3::Tag->new($filename);
$id3v1 = $mp3->new_tag("ID3v1"); # Empty new tag
or
$mp3 = MP3::Tag->new($filename);
$mp3->get_tags();
$id3v1 = $mp3->{ID3v1}; # Existing tag (if present)
instead of using this function directly
SEE ALSO
MP3::Tag, MP3::Tag::ID3v2
ID3v1 standard - http://www.id3.org
COPYRIGHT
Copyright (c) 2000-2004 Thomas Geffert. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, distributed with Perl.
perl v5.14.2 2009-11-28 MP3::Tag::ID3v1(3pm)