04-07-2013
Quote:
Originally Posted by
RudiC
@Don Cragun: Absolutely! I started fiddling around with awk, thinking about the more-than-one-digit (sub-)release numbers, and it became awkward. What I proposed above is just dealing with the simple sample posted in #1.
The ".data" is a constant. The release numbers only contains numeric characters, no alphabetic characters. It is separated by "." character, but it could be two, or tree or four, such as 2.0, or 2.0.0, or 2.0.0.1.
The location always contain one "." character. The dataName is a single string, the dataName, versionNumber and releaseNumber are delimeted by "-", but after the releaseNumber, the "." is delimeted between the releaseNumber and localtion. The localtion can be treated as constant as well.
Thanks RudiC and Don Cragun.
10 More Discussions You Might Find Interesting
1. AIX
Hi...
Can i remove one APAR number from aix5.3..
If it is possible how to do..
Thanks.. (3 Replies)
Discussion started by: sumathi.k
3 Replies
2. Shell Programming and Scripting
I have string like 20091112_File_Name_40301.txt
and i have a set of files in the directory with the same format . i want to write the ksh to rename the file ..... like
eg
20091112_File_Name_40301.txt to File_Name.txt
20091112_abc_2343.txt to abc.txt... (6 Replies)
Discussion started by: gavemani
6 Replies
3. Shell Programming and Scripting
hi all
i want to remove some descending order number
example :
1 100 200 135.00 Gk_wirs 1
1 100 200 136.00 Gk_wirs 50
1 110 210 138.00 Gk_wirs 60
1 100 200 136.00 Gk_wirs 57 ----> how to remove... (6 Replies)
Discussion started by: nithyanandan
6 Replies
4. Shell Programming and Scripting
Hi!
I just want to count number of files in a directory, and write to new text file, with number of files and their name
output should look like this,,
assume that below one is a new file created by script
Number of files in directory = 25
1. a.txt
2. abc.txt
3. asd.dat... (20 Replies)
Discussion started by: Akshay Hegde
20 Replies
5. Shell Programming and Scripting
Hi,
I need to delete last number ( i.e 126) from the file which has below contents.
ABC DEF "XYZ" 2837.5 3852.5 126
ABC DEF "XYZ" 2897.5 3852.5 126
ABC DEF "XYZ" 2957.5 3852.5 126
Please help.
Thanks in advance. (17 Replies)
Discussion started by: gujrathinr
17 Replies
6. UNIX for Dummies Questions & Answers
I need to write a BASH script that takes a 2 character string and removes the second character if it is not a digit e.g.
If the string is numberical value >9 e.g. string1 = '34' then leave string1 = '34'.
However if the string is <10 e.g. string1 = '3X' then remove the second char (which... (7 Replies)
Discussion started by: millsy5
7 Replies
7. Shell Programming and Scripting
I have some strings such as
ABC1
ABC2
TYFASDD12
They will only have letters and numbers. In each case I want to remove the last digit? The lengths will vary. So a hard coded substr won't work. What do I do?
if it doesn't end in a number, I don't want to remove any characters. (6 Replies)
Discussion started by: guessingo
6 Replies
8. Solaris
Hi ,
i have a file name with date and time append like
test_SEC_AES_V1_T03_2016031404306
i want to remove the date and time after _ and rename to current date and time,can any one please let me know as i tried some options but din't help:(
Thanks,
Please use code tags as required... (10 Replies)
Discussion started by: caba_jones
10 Replies
9. Shell Programming and Scripting
Hi experts,
I am using KSH and I am need to display file with number in front of file names and user can select it by entering the number.
I am trying to use following command to display list with numbers. but I do not know how to capture number and identify what file it is to be used for... (5 Replies)
Discussion started by: mysocks
5 Replies
10. UNIX for Beginners Questions & Answers
hello !
I have to remove string between a number and set of characters. For example,
35818 -stress - - -stress - - - - - - DB-3754
44412 caul kid notify DB-3747
54432 roberto -, notify DB-3725
55522 aws _ _int _ _classified 2_a _a 2_m _m 2_classified 2_search... (7 Replies)
Discussion started by: ManoharMa
7 Replies
LEARN ABOUT LINUX
update-motd
update-motd(5) File Formats Manual update-motd(5)
NAME
update-motd - dynamic MOTD generation
SYNOPSIS
/etc/update-motd.d/*
DESCRIPTION
UNIX/Linux system adminstrators often communicate important information to console and remote users by maintaining text in the file
/etc/motd, which is displayed by the pam_motd(8) module on interactive shell logins.
Traditionally, this file is static text, typically installed by the distribution and only updated on release upgrades, or overwritten by
the local administrator with pertinent information.
Ubuntu introduced the update-motd framework, by which the motd(5) is dynamically assembled from a collection of scripts at login.
Executable scripts in /etc/update-motd.d/* are executed by pam_motd(8) as the root user at each login, and this information is concatenated
in /var/run/motd. The order of script execution is determined by the run-parts(8) --lsbsysinit option (basically alphabetical order, with
a few caveats).
On Ubuntu systems, /etc/motd is typically a symbolic link to /var/run/motd.
BEST PRACTICES
MOTD fragments must be scripts in /etc/update-motd.d, must be executable, and must emit information on standard out.
Scripts should be named named NN-xxxxxx where NN is a two digit number indicating their position in the MOTD, and xxxxxx is an appropriate
name for the script.
Scripts must not have filename extensions, per run-parts(8) --lsbsysinit instructions.
Packages should add scripts directly into /etc/update-motd.d, rather than symlinks to other scripts, such that administrators can modify or
remove these scripts and upgrades will not wipe the local changes. Consider using a simple shell script that simply calls exec on the
external utility.
Long running operations (such as network calls) or resource intensive scripts should cache output, and only update that output if it is
deemed expired. For instance:
/etc/update-motd.d/50-news
#!/bin/sh
out=/var/run/foo
script="w3m -dump http://news.google.com/"
if [ -f "$out" ]; then
# Output exists, print it
echo
cat "$out"
# See if it's expired, and background update
lastrun=$(stat -c %Y "$out") || lastrun=0
expiration=$(expr $lastrun + 86400)
if [ $(date +%s) -ge $expiration ]; then
$script > "$out" &
fi
else
# No cache at all, so update in the background
$script > "$out" &
fi
Scripts should emit a blank line before output, and end with a newline character. For instance:
/etc/update-motd/05-lsb-release
#!/bin/sh
echo
lsb-release -a
FILES
/etc/motd, /var/run/motd, /etc/update-motd.d
SEE ALSO
motd(5), pam_motd(8), run-parts(8)
AUTHOR
This manpage and the update-motd framework was written by Dustin Kirkland <kirkland@canonical.com> for Ubuntu systems (but may be used by
others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version
3 published by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.
update-motd 13 April 2010 update-motd(5)