Sponsored Content
Full Discussion: Mapped list replacement
Top Forums Shell Programming and Scripting Mapped list replacement Post 302244811 by treesloth on Wednesday 8th of October 2008 03:54:11 PM
Old 10-08-2008
Quote:
Originally Posted by ashishparimoo
Iam not sure if these keywords are appearing in a file. Have you tried considering SET command
You need to replace "," by space using "tr"
Read file and each line use can use set command then replace $2 with $1 within a loop ?

the way set works is as
set hi there it is a test
if you echo $3 it prints out "it"
similary as long as there is a space you can print Variables as $1 $2 $3 $4 using set.
Hope this sorts out your problem. Good luck
No, they don't appear in an actual list. I was just using that as a way of picturing what replaces what. In fact, the question that prompted this was that a particular log file uses MON format for the month (that is, spelled-out, first 3 letters, such as Jan, Feb, etc). We needed this to be converted to numeric format, such that Jan becomes 01, Feb becomes 02, and so on. I ended up doing:

Code:
<input> | sed -e 's/Jan/01/' -e 's/Feb/02/' -e 's/Mar/03/' -e 's/Apr/04/' -e 's/May/05/' -e 's/Jun/06/' -e 's/Jul/07/' -e 's/Aug/08/' -e 's
/Sep/09/' -e 's/Oct/10/' -e 's/Nov/11/' -e 's/Dec/12/'`

That worked, but if there's a more convenient and compact way to do this, I'd like to know it.
 

10 More Discussions You Might Find Interesting

1. Linux

How to access mapped dirve in Linux

i want to access mounted/mapped drive in linux using C code is it possible to access the mapped drive in linux using C code ? waiting for replay NIrav (0 Replies)
Discussion started by: niravuchat
0 Replies

2. Filesystems, Disks and Memory

Virtual Machine and Mapped Raw LUN's

Hello, I have a server running CentOS 5.1 on a virtual machine. Right now, there is one virtual disk on the system. Below are the result when I run the df commmand: Filesystem.....1K-blocks.........Used.....Available....Use%.....Mounted on... (1 Reply)
Discussion started by: kennyw1000
1 Replies

3. SCO

SCO Mapped Drive

We are running SCO OpenServer 5.0.7. Some of my users have drives mapped to the SCO box, some don't. The consultant, who setup the mapped drives, is long gone, and I need more users to have drive letter mapping. When I try to map a drive via windows, I am repeatedly asked for a user/password,... (1 Reply)
Discussion started by: bnhcomputing
1 Replies

4. UNIX for Advanced & Expert Users

Linux: Access time of mapped data

Before I forget, I'm running on a RedHat 5 box with the following uname -a output: Linux gnc141c 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux Now on to my question. I'm using a tool that maps a Matlab .mat file using the Linux mmap functionality and then... (1 Reply)
Discussion started by: rusttree
1 Replies

5. Programming

segmantation Fault error SEGV_MAPERR - Address not mapped to object

Program received signal SIGSEGV, Segmentation fault si_code: 1 - SEGV_MAPERR - Address not mapped to object. 0x9fffffffbe7080d0:0 in free+0xb0 () from /usr/lib/hpux64/libc.so.1 Hi , I have developed a class to read config file (flat file with space as a field seperator ) on plattform... (3 Replies)
Discussion started by: pravinbhingare
3 Replies

6. Solaris

Unexpected mapped volume in Solaris 10

Hi everybody, I'm facing a little trouble with my system. I have a SPARC M4000 server, which connected to a SAN with 2 Brocade 300 Switches and 1 STK 6140. The M4000 has 2 FC HBA cards, one port per card. Each card connect to one switch as follows... ____________M4000____________ ___FC-HBA... (2 Replies)
Discussion started by: nam.nguyen
2 Replies

7. Shell Programming and Scripting

mappin strings of two different file and finding the mapped string and then map other fields.

As i am new to unix so facing some problems in scripting: here is my question: i m having two files. 1st file say a.txt contain 3 column like SPECIALITY|UMP_CODE|SPECIALTY_CODE Addictive Diseases|25ADD|ADD Addictive Diseases/Family Practice|25ADD|ADD/FP Aerospace Medicine|1.041666667|AM... (4 Replies)
Discussion started by: dsh007
4 Replies

8. AIX

how will i know if a lun has been already mapped to a vio client

Hi im logged in to the vio servers now. when i give # lspv | wc -l i get the count as 6246 how will i know if a lun has been already mapped to a vio client or it is left free without mapping to any of the vio client ? (1 Reply)
Discussion started by: newtoaixos
1 Replies

9. Red Hat

Crontab not generating file in mapped drive in windows

Dear Experts, I've schedule scripts with the help of Cronjob, and output should be generated on windows mapped drive, Earlier 2 days its was working fine and now my cronjob is not generating file on windows network drive. Please suggest. Linux details given below. $ tail... (9 Replies)
Discussion started by: Mohammed Fareed
9 Replies

10. Shell Programming and Scripting

mapped reads using samtools flagstat options

Hey guys, Does anyone know how to calculate total number of mapped reads for a certain region of a bam file using samtools flagstat? I know to use flagstat for the whole bam file. but for a specific region of it... is there an option? Tnx ---------- Post updated at 12:27 PM ----------... (1 Reply)
Discussion started by: @man
1 Replies
JDMONTHNAME(3)								 1							    JDMONTHNAME(3)

jdmonthname - Returns a month name

SYNOPSIS
string jdmonthname (int $julianday, int $mode) DESCRIPTION
Returns a string containing a month name. $mode tells this function which calendar to convert the Julian Day Count to, and what type of month names are to be returned. Calendar modes +-----+--------------------------------------+---+ |Mode | | | | | | | | | Meaning | | | | | | | | Values | | | | | | +-----+--------------------------------------+---+ | 0 | | | | | | | | | Gregorian - abbreviated | | | | | | | | Jan, Feb, Mar, Apr, May, Jun, Jul, | | | | Aug, Sep, Oct, Nov, Dec | | | | | | | 1 | | | | | | | | | Gregorian | | | | | | | | January, February, March, April, | | | | May, June, July, August, September, | | | | October, November, December | | | | | | | 2 | | | | | | | | | Julian - abbreviated | | | | | | | | Jan, Feb, Mar, Apr, May, Jun, Jul, | | | | Aug, Sep, Oct, Nov, Dec | | | | | | | 3 | | | | | | | | | Julian | | | | | | | | January, February, March, April, | | | | May, June, July, August, September, | | | | October, November, December | | | | | | | 4 | | | | | | | | | Jewish | | | | | | | | Tishri, Heshvan, Kislev, Tevet, She- | | | | vat, AdarI, AdarII, Nisan, Iyyar, | | | | Sivan, Tammuz, Av, Elul | | | | | | | 5 | | | | | | | | | French Republican | | | | | | | | Vendemiaire, Brumaire, Frimaire, | | | | Nivose, Pluviose, Ventose, Germinal, | | | | Floreal, Prairial, Messidor, Thermi- | | | | dor, Fructidor, Extra | | | | | | +-----+--------------------------------------+---+ PARAMETERS
o $jday - The Julian Day to operate on o $calendar - The calendar to take the month name from RETURN VALUES
The month name for the given Julian Day and $calendar. PHP Documentation Group JDMONTHNAME(3)
All times are GMT -4. The time now is 03:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy