Sponsored Content
Full Discussion: Simple SED edit
Top Forums Shell Programming and Scripting Simple SED edit Post 302103107 by rdudejr on Tuesday 16th of January 2007 12:51:00 PM
Old 01-16-2007
Simple SED edit

I have output like the following:

B D 20070116095820001 N D S0000579.LOG S0000582.LOG
B D 20070116095750001 N D S0000574.LOG S0000576.LOG
B D 20070116095734001 N D S0000570.LOG S0000573.LOG
B D 20070116095705001 N D S0000569.LOG S0000569.LOG
B D 20070116095644001 N D S0000566.LOG S0000567.LOG
B D 20070116095556001 N D S0000563.LOG S0000566.LOG
B D 20070116095516001 N D S0000562.LOG S0000562.LOG
B D 20070116095313001 N D S0000562.LOG
B D 20070116094213001 N D S0000562.LOG
B D 20070116094018001 N D S0000559.LOG
B D 20070116093927001 N D S0000553.LOG S0000553.LOG
B D 20061219112717001 F D S0000000.LOG S0000000.LOG

and I need to grab the 5th occurance of *.LOG (S0000570.LOG). The catch is that the number preceeding the .LOG string will change and the entire line is actually one word (verified this by trying to search for just the word S0000570.LOG using grep -w S0000570.LOG and I got the entire line back). The consistant thing is that the *.LOG string i need will always be 11 characters (such as S0000570.LOG). Can I do this with SED?

*edit* grammer
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

simple file edit

What command can I use to simply edit a file by searching for a word and then deleting the lines that I find that word in? (4 Replies)
Discussion started by: capesong
4 Replies

2. Shell Programming and Scripting

SED text edit help needed

Could someone please tell me how to delete all lines above a line which contains a particular string? (possibly using SED command) I know how to do this if the target string appears in only one line of file but when it appears in multiple lines it only deletes from the first line which the string... (3 Replies)
Discussion started by: stevefox
3 Replies

3. Shell Programming and Scripting

Help edit simple payroll script?

I'm trying to write a simple script to figure pay with overtime...I got the first part to work, but I can't seem to get the second if statement's syntax right...:confused:I want it to take the 40 hours times 10 dollars, but then i want whatever is left over (like 7 of 47 hours) and take that times... (6 Replies)
Discussion started by: miss72006
6 Replies

4. Shell Programming and Scripting

Sed or Awk or both to edit file

What is an efficient way to remove all lines from the input file which contain a file name? inputfile: ======================= # comment # comment # comment 5 8 10 /tmp 5 8 10 /var/run 5 8 10 /etc/vfstab 5 8 9 /var/tmp 5 8 10 /var/adm/messages... (7 Replies)
Discussion started by: Arsenalman
7 Replies

5. Shell Programming and Scripting

sed edit in place -i issues

Hello, I am attempting to create a command that I can eventually put into a loop so I can edit 1file on many servers. I would like to edit the file in place with sed -i. If not I will take any suggestions on how to use a temp file. I need to remove a email address from the configuration file... (4 Replies)
Discussion started by: abacus
4 Replies

6. UNIX for Dummies Questions & Answers

sed to edit nth filed

Hi all, I want to edit nth filed of a comma delimited line with some value. Can I use sed command to do this. Pls suggest me the command here. Thanks, Poova. (2 Replies)
Discussion started by: poova
2 Replies

7. Shell Programming and Scripting

edit field using sed or awk

please help me to edit the second field using awk or sed i have input file below aa1001 000001 bb1002 000002 cc1003 000003 so i want the output file like below aa1001 01 bb1002 02 cc1003 03 (38 Replies)
Discussion started by: zulabc
38 Replies

8. Shell Programming and Scripting

Script to make simple recurring ascii file edit

Hi, I have an ascii file with recurring lines (the file is 36mb so lots of lines) which look like this: -2.5 -66.324-68.138 935.2 1.953 -0.664 272.617 73.684 -2.428 269.998 0.000 Every 14 lines there is a blank line. I would like to, for each non-blank line,... (2 Replies)
Discussion started by: blueade7
2 Replies

9. Shell Programming and Scripting

edit sed command

how can i make this sed command run faster? sed '51000000,51347442!d' file and sed '51347442,$ !d' file File is a 9GB in size. it runs on sunos 5.10 and linux red hat 6 servers and i use bash. (5 Replies)
Discussion started by: SkySmart
5 Replies

10. Shell Programming and Scripting

Using sed to edit multiple files

Created a shell script to invoke sed to edit multiple files, but am missing something. Here's the shell script: oracle:$ cat edit_scripts.sh #!/bin/sh #------------------------------------------------------------------------------ # edit_scripts.sh # # This script executes sed to make global... (4 Replies)
Discussion started by: edstevens
4 Replies
LOG(3)							     Linux Programmer's Manual							    LOG(3)

NAME
log, logf, logl - natural logarithmic function SYNOPSIS
#include <math.h> double log(double x); float logf(float x); long double logl(long double x); Link with -lm. Feature Test Macro Requirements for glibc (see feature_test_macros(7)): logf(), logl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99 DESCRIPTION
The log() function returns the natural logarithm of x. RETURN VALUE
On success, these functions return the natural logarithm of x. If x is a NaN, a NaN is returned. If x is 1, the result is +0. If x is positive infinity, positive infinity is returned. If x is zero, then a pole error occurs, and the functions return -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively. If x is negative (including negative infinity), then a domain error occurs, and a NaN (not a number) is returned. ERRORS
See math_error(7) for information on how to determine whether an error has occurred when calling these functions. The following errors can occur: Domain error: x is negative errno is set to EDOM. An invalid floating-point exception (FE_INVALID) is raised. Pole error: x is zero errno is set to ERANGE. A divide-by-zero floating-point exception (FE_DIVBYZERO) is raised. CONFORMING TO
C99, POSIX.1-2001. The variant returning double also conforms to SVr4, 4.3BSD, C89. BUGS
In glibc 2.5 and earlier, taking the log() of a NaN produces a bogus invalid floating-point (FE_INVALID) exception. SEE ALSO
cbrt(3), clog(3), log2(3), log10(3), log1p(3), sqrt(3) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2010-06-13 LOG(3)
All times are GMT -4. The time now is 07:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy