Sponsored Content
Top Forums Shell Programming and Scripting Grepping string from out file Post 302392271 by thegeek on Wednesday 3rd of February 2010 09:53:28 PM
Old 02-03-2010
Somewhat similar:

Code:
grep -o '#[^#]*' FILE
# [Services](config http Firewall)
#  admin-state enabled
# [Services](config)
# Overwrite previously saved configuration? [y/n]: Configuration saved successfully.
# [Services]
# Goodbye


If you would want to grep out using regex, then you should have to have some relationship between all the data which you want. Then only you can pull it off ?!

Kindly clarify your requirement better.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grepping the first 3 characters from a file

Hi I was wondering if it's possible to use a command to get the first 3 characters of a line in a text file, I tried grep but it returns the whole line but I am only interested in the first 3 characters. Is this possible with grep or I need any other command? Also is it possible deleting from... (2 Replies)
Discussion started by: g-e-n-o
2 Replies

2. UNIX for Dummies Questions & Answers

grepping the first 3 characters from a file

give this a try and let me know if it works grep '^' filename rachael (2 Replies)
Discussion started by: rachael
2 Replies

3. Shell Programming and Scripting

Grepping log file

Dear All, I have a log file that is dislpayed as: <msg time='2009-10-14T05:46:42.580+00:00' org_id='oracle' comp_id='tnslsnr' type='UNKNOWN' level='16' host_id='mtdb_a' host_addr='UNKNOWN' version='1'> <txt>14-OCT-2009 05:46:42 *... (19 Replies)
Discussion started by: x-plicit78
19 Replies

4. AIX

Help with looping a file and grepping a string

I have 2 files: fileA and fileB. content of fileA --------------- admin.teacher is in new york; admin.mason is in new york; admin.driver is in new york city; user.trucker is in hartford; admin.developer is in new york state; content of fileB ---------------- admin.teacher is in... (8 Replies)
Discussion started by: lowprofile
8 Replies

5. Shell Programming and Scripting

Grepping file and returning passed variable if the value does not exist in file at all.

I have a list of fields that I want to check a file for, returning that field if it not found at all in the file. Is there a way to do a grep -lc and return the passed variable too rather then just the count? I am doing some crappy work-around now but I was not sure how to regrep this for :0 so... (3 Replies)
Discussion started by: personalt
3 Replies

6. Shell Programming and Scripting

grepping multiple matches in a single string

Hi All, I'm trying to grep for 3 patterns in a string of gibberish. It so happens that each line is appended by a date/time stamp and i was able to figure out how to extract only the datetime. here is the string.. i have to display tinker tailor soldier spy Please can some help... (2 Replies)
Discussion started by: Irishboy24
2 Replies

7. Shell Programming and Scripting

Display file date after grepping a string in the file

Hi All, I need to recursively grep several folders for a MAC address and display the results with the date of the file name at the start. Even better would be if the final results were displayed chronologically so the newest file is always at the end. Oldest at the top, regardless of what... (8 Replies)
Discussion started by: quemalr
8 Replies

8. AIX

Grepping before and after lines for required string

Hi All, I am new to AIX unix . i need to grep for a pattern and if pattern is found then i need 3 before the pattern line found and 3 lines after the pattern found. (11 Replies)
Discussion started by: coolvibh
11 Replies

9. Shell Programming and Scripting

Grepping the logs with respect to string search

Hi Folks, I have a log file at the following location.. /opt/ert/abc.log Now abc.log contain the following enteries in this format below.. 23-Jul-2014 10:09.32.204 ERROR abc.log cdfrer tyre fgty >>>>> cqno : 78539132 abc Id : 0 Sabc : 20140724 Now in log file (abc.log) I want to... (2 Replies)
Discussion started by: tuntun343466
2 Replies

10. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies
XLITO(1)						      General Commands Manual							  XLITO(1)

NAME
xlito - Append/Delete/Show a Trailing Option string in a file. (XLoadImageTrailingOptions) SYNOPSIS
xlito [option] [string] files ... DESCRIPTION
xlito (XLoadImageTrailingOptions) is a utility that provides a file format independent way of marking image files with the appropriate options to display correctly. It does this by appending to a file, a string specified by the user. The string is marked with some magic numbers so that it can be extracted by a program that knows what to look for. Since almost all image files have some sort of image dimen- sion information in the file, the programs that load or manipulate these files generally do not look beyond the point at which they have read the complete image, so trailing information is safely be hidden. If appending this information causes trouble with other utilities, it can simply be deleted. Appropriate version of xloadimage (ie. xli 1.00) will recognise these trailing options at the end of the image files, and will treat the embedded string as if it were a sequence of command line Image Options. Any Global Options will be ignored, and unlike command line image Options, Trailing Options are never propagated to other images. Old versions of xloadimage (3.01 or less) can be made forward compatible by using the -x option to pull the trailing options out of the image files, and put them on the command line where xloadimage can see them. OPTIONS
The default behavior is to display the trailing option strings (if any) of the files on the argument line. The following options change the behavior of xlito: -c option_string file_name ... This adds or changes the embedded string to option_string. The string will have to be quoted if it is composed of more than one word. -d file_name ... Delete any embedded trailing option strings in the given files. -x file_name ... Process the files and create a command line string suitable for use by xloadimage. Arguments starting with - are echoed, arguments not starting with - are treated as files and any trailing options strings are echoed followed by the file name. The xloadimage option -name is treated correctly. EXAMPLES
If fred.gif has the wrong aspect ratio, then it might need viewing with the xloadimage options: xloadimage -yzoom 130 fred.gif This option can then be appended to the file by: xlito -c "-yzoom 130" fred.gif and from then on some new versions of xloadimage will get the appropriate options from the image file itself. Old versions of xloadimage can be made to work by using: xloadimage `xlito -x fred.gif` This can be made transparent by using a script containing something like: xloadimage `xlito -x $*` The script could be called xli for instance. The options can be deleted with: xlito -d fred.gif AUTHOR
Graeme Gill Labtam Australia graeme@labtam.oz.au MAINTAINER
smar@reptiles.org COMPATIBILITY WITH IMAGE FILES
Some image files are actually ascii files that are used in other contexts. X Bitmap files are an example. They are formatted as 'C' style #defines and an initialised array of characters, so that they can be included in 'C' source code. Adding trailing options would therefore render the file unusable with a compiler, since it will get a syntax error on the railing option string and the magic numbers. The solution to this is that xlito will ignore a certain amount (a few hundred bytes) after the trailing options, and uses a padding of 20 bytes before the trailing options. These two areas will be maintained when changing an existing trailing option. In the case of an X bitmap then, the solution is to edit the file and place the embedded string in some 'C' comments: eg: say the file starts as: #define tt_width 4 #define tt_height 4 static char tt_bits[] = { 0x08, 0x02, 0x04, 0x01}; and you add a trailing options: #define tt_width 4 #define tt_height 4 static char tt_bits[] = { 0x08, 0x02, 0x04, 0x01}; 01234567890123456789XXX xloadimage trailing options XXX0007"-smooth"0007XXX xloadimage trailing options XXX Then the trailing options can be commented out: #define tt_width 4 #define tt_height 4 static char tt_bits[] = { 0x08, 0x02, 0x04, 0x01}; /*234567890123456789XXX xloadimage trailing options XXX0007"-smooth"0007XXX xloadimage trailing options XXX */ BUGS
xlito doesn't cope with compressed files. A files will need uncompressing, the options added, and then compressing again. 7 Jul 1993 XLITO(1)
All times are GMT -4. The time now is 06:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy