Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Find, Replace & Edit a string? Post 302311862 by squosl on Wednesday 29th of April 2009 09:17:01 PM
Old 04-29-2009
I don't know if it's the best way, but I'd setup a script with a line like:
monthnum=0
for month in (Jan Feb Mar Apr); do
monthnum=$(($monthnum+1))
sed -e "s/'$month'/'$monthnum/" <infile >outfile
done

Thats off the top of my head, obviously you'll need to write the whole script
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find & Replace

I get a text file with 70+ columns (seperated by Tab) and about 10000 rows. The 58th Column is all numbers. But sometimes 58th columns has "/xxx=##" after the numeric data. I want to truncate this string using the script. Any Ideas...:confused: (3 Replies)
Discussion started by: gagansharma
3 Replies

2. UNIX for Dummies Questions & Answers

improving my script (find & replace)

Hi all, I have a script that scan files, find old templet and replace it with new one. #!/bin/ksh file_name=$1 old_templet=$2 new_templet=$3 # Loop through every file like this for file in file_name do cat $file | sed "s/old_templet/new_templet/g" > $file.new #do a global searce and... (8 Replies)
Discussion started by: amir_yosha
8 Replies

3. UNIX for Dummies Questions & Answers

String Search & Replace

Hey, I want to have a C program which, for an existing file supplied by the command line argument (E.g. File1.txt) replaces all the occurrences of the words: "We” or “we” by “I” “a” by “the” “A” by “The”. Then print the replaced file. All other characters of the file are to be left... (1 Reply)
Discussion started by: IwishIknewC
1 Replies

4. UNIX for Dummies Questions & Answers

vi search & replace ... having '/' in string - problem.

I want to carry out search & replace for the paths mentioned in the file with the help of vi. 'abc/' to be replaced by 'abc/data' When I use command in vi as below - %s/abc//abc/data/g it gives me an error. How we should deal with '/' part in string for vi search & replace? ... (6 Replies)
Discussion started by: videsh77
6 Replies

5. Shell Programming and Scripting

find & incremental replace?

Looking for a way using sed/awk/perl to replace port numbers in a file with an incrementing number. The original file looks like... Host cmg-iqdrw3p4 LocalForward *:9043 localhost:9043 Host cmg-iqdro3p3a LocalForward *:10000 localhost:10000 Host cmg-iqdro3p3b LocalForward... (2 Replies)
Discussion started by: treadwm
2 Replies

6. Shell Programming and Scripting

Find & Replace string in multiple files & folders using perl

find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g' this is simple logic to find and replace in multiple files & folders Hope this helps. Thanks Zaheer (0 Replies)
Discussion started by: Zaheer.mic
0 Replies

7. Shell Programming and Scripting

Script to find & replace a multiple lines string across multiple php files and subdirectories

Hey guys. I know pratically 0 about Linux, so could anyone please give me instructions on how to accomplish this ? The distro is RedHat 4.1.2 and i need to find and replace a multiple lines string in several php files across subdirectories. So lets say im at root/dir1/dir2/ , when i execute... (12 Replies)
Discussion started by: spfc_dmt
12 Replies

8. Shell Programming and Scripting

LINUX - How to replace a string & its current value with a new value

Hi All, i am trying to replace a string & its current value (P_JOBID =1000 for eg) in a file with a new value(P_JOBID =2000) through sed command. File name : A.txt Command I am trying : `cat $path/A.txt | grep ${P_JOBID} | sed -e s/P_JOBID=/P_JOBID="$JobID"/g` Output Expected :... (5 Replies)
Discussion started by: dsfreddie
5 Replies

9. UNIX for Dummies Questions & Answers

Find & Replace

Hi I am looking to rename the contents of this dir, each one with a new timestamp, interval of a second for each so it the existing format is on lhs and what I want is to rename each of these to what is on rhs..hopefully it nake sense CDR.20060505.150006.gb CDR.20121211.191500.gb... (3 Replies)
Discussion started by: rob171171
3 Replies

10. Shell Programming and Scripting

HPUX find string in directory and filetype and replace string

Hi, Here's my dilemma. I need to replace the string Sept_2012 to Oct_2012 in all *config.py files within the current directory and below directories Is this possible? Also I am trying to find all instances of the string Sept_2012 within files in the current directory and below I have... (13 Replies)
Discussion started by: pure_jax
13 Replies
oggz-chop(1)						      General Commands Manual						      oggz-chop(1)

NAME
oggz-chop -- Extract the part of an Ogg file between given start and/or end times. SYNOPSIS
oggz-chop [-o filename | --output filename ] [-s start_time | --start start_time ] [-e end_time | --end end_time ] [-k | --no-skele- ton ] filename oggz-chop [-h | --help ] [-v | --version ] Description oggz-chop chops a section of an Ogg file. It correctly interprets the granulepos timestamps of Ogg CELT, CMML, Dirac, FLAC, Kate, PCM, Speex, Theora and Vorbis bitstreams. Run oggz-known-codecs(1) for a full list of codecs known by the installed version of oggz. The output file contains copies of the headers of the input file, and all the codec data required to correctly decode the content between the start and end times specified on the commandline. For codecs with data dependencies like video keyframes, the keyframe prior to the starting time will be included in the output. Note that oggz-chop operates by copying pages of Ogg data; it does not strip partial packets from the first or last data page included in the output. It does however ensure to set the end of stream flag on the last page of each logical bitstream. Skeleton handling: By default, the output will contain a Skeleton track specifying the start of the chop as presentation time. Options oggz-chop accepts the following options: Output options -o filename, --output filename Write output to the specified filename instead of printing it to standard output. -s start_time, --start start_time Specify the start time of the chopped section to output. -e end_time, --end end_time Specify the end time of the chopped section to output. -k , --no-skeleton Do NOT include a Skeleton bitstream in the output. -h, --help Display usage information and exit. -v, --version Output version information and exit. EXAMPLES
Extract the first minute of file.ogx: oggz chop -e 1:00 file.ogx Extract from the second to the fifth minute of file.ogx: oggz chop -s 2:00 -e 5:00 -o output.ogx file.ogx Extract, specifying SMPTE-25 frame offsets: oggz chop -s smpte-25:00:02:03::12 -e smpte-25:00:05:02::04 -o output.ogv file.ogv Server configuration The following configuration for Apache httpd will enable oggz-chop. As with most Apache directives, this may of course be restricted to particular Directories or Locations: ScriptAlias /oggz-chop /usr/bin/oggz-chop Action application/ogg /oggz-chop HTTP/1.1 Cacheability oggz-chop generates Last-Modified HTTP headers, and responds correctly to If-Modified-Since conditional GET requests. AUTHOR
Conrad Parker February 25, 2008; COPYRIGHT
Copyright (C) 2008 Annodex Association SEE ALSO
oggz-validate(1), oggz-merge(1), oggz-dump(1), hogg(1) oggz-chop(1)
All times are GMT -4. The time now is 09:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy