Sponsored Content
Top Forums Shell Programming and Scripting Extracting data from between double quotes Post 302849473 by Don Cragun on Sunday 1st of September 2013 11:52:17 PM
Old 09-02-2013
Quote:
Originally Posted by briandanielz
Yes. My bad for not being specific. I was just posting how to extract the variable.

I was thinking loop over the file with an array..
pseudo (untested)

Code:
while read line
	do
	    name=$line
	    if [[ $line == *fooBar* ]]; then #Some Search condition 
		line1="${line##*href\=\"}"
		line2="${line1%\"\>*}"
		array+=("$line2")
	    fi
	done < $file

I'm confused: Are you briandanielz or are you ajayram_arya? Both of you seem to be answering questions about what is wanted and posting very similar segments of code that you're using to solve parts of the problem.

Shell array sizes in both ksh and bash are limited. Since your input is a "huge file", the shell array limits may be your problem.

What are you going to do with the array after you have processed your "huge file"? Can't you instead process the data from each line in your huge file as you find it without keeping a list of that data from all of the lines you've processed in an array?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comparing scalars contaning "DOUBLE QUOTES" as data

Hello to all, Does anyone know the solution ? Two strings A and B are present. I want to check whether B is a Substring of A. 1. The value of A is - 29 * * * /bin/ls "test" "tmp*" "log*" (Note: Pl note that A contains DOUBLEQUOTES, ASTERISK & FRONTSLASH) 2. The value of B is -... (5 Replies)
Discussion started by: rssrik
5 Replies

2. Shell Programming and Scripting

Double quotes or single quotes when using ssh?

I'm not very familiar with the ssh command. When I tried to set a variable and then echo its value on a remote machine via ssh, I found a problem. For example, $ ITSME=itsme $ ssh xxx.xxxx.xxx.xxx "ITSME=itsyou; echo $ITSME" itsme $ ssh xxx.xxxx.xxx.xxx 'ITSME=itsyou; echo $ITSME' itsyou $... (3 Replies)
Discussion started by: password636
3 Replies

3. Shell Programming and Scripting

Single quotes and double quotes

Hi guys, I have a sed line in double quotes which works fine, but I want it to be in single quotes here is the sed line sed "/abc_def/s/\'.*\'/\'\${abc_def}\'/" can some one give the equivalent to the above script in single quotes Thanks a ton (5 Replies)
Discussion started by: sol_nov
5 Replies

4. UNIX for Dummies Questions & Answers

grep single quotes or double quotes

Unix superusers, I am new to unix but would like to learn more about grep. I am very familiar with regular expressions as i have used them for searching text files in windows based text editors. Since I am not very familiar with Unix, I dont understand when one should use GREP with the... (2 Replies)
Discussion started by: george_vandelet
2 Replies

5. Shell Programming and Scripting

Extract data based on 2nd colume having double quotes

i want extract where the 2nd column having "3" or "7". Based on the forums tried like this but it is not working awk -F"," '$2=3;$2=7 {print}' filename Source "1","2","3","4" "1","3","3","4" "1","7","3","4" "1","8","3","4" "1","2","3","4" "1","2","3","4" Output : ... (5 Replies)
Discussion started by: onesuri
5 Replies

6. Shell Programming and Scripting

Issue with Single Quotes and Double Quotes for prompt PS1

Hi, Trying to change the prompt. I have the following code. export PS1=' <${USER}@`hostname -s`>$ ' The hostname is not displayed <abc@`hostname -s`>$ uname -a AIX xyz 1 6 00F736154C00 <adcwl4h@`hostname -s`>$ If I use double quotes, then the hostname is printed properly but... (3 Replies)
Discussion started by: bobbygsk
3 Replies

7. Shell Programming and Scripting

Handling embedded double quotes within column data

I have a text file where each field is enclosed in double quotes and separated by a comma. But in certain rows we have embedded double quotes within column data For e.g """TRUSPICE CENTRE"" CLAYTON AU" The above value is for a single column but there are embedded quotes within... (2 Replies)
Discussion started by: abhilashnair
2 Replies

8. Shell Programming and Scripting

Skip the delimiter with in double quotes and count the number of delimiters during data extract

Hi All, I'm stuck-up in finding a way to skip the delimiter which come within double quotes using awk or any other better option. can someone please help me out. Below are the details: Delimited: | Sample data: 742433154|"SYN|THESIS MED CHEM PTY.... (2 Replies)
Discussion started by: BrahmaNaiduA
2 Replies

9. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies

10. Shell Programming and Scripting

Replace double quotes inside the string data for all the columns

Please use code tags Hi, I have input data is below format and n of column in the multiple flat files. the string data has any double quotes(") values replaced to double double quotes for all the columns{""). Also, my input flat file each column string data has carriage of new line too.... (14 Replies)
Discussion started by: SSrini
14 Replies
TextDisplay(3I) 					    InterViews Reference Manual 					   TextDisplay(3I)

NAME
TextDisplay - unstructured text display SYNOPSIS
#include <InterViews/textdisplay.h> DESCRIPTION
A TextDisplay manages and displays an array of lines of text. Operations are provided to insert and delete lines, to insert and delete text within a line, and to scroll the display. TextDisplays are typically used to implement interactors that require non-trivial display of unstructured text. The array is addressed by a line number and an index into the line. Text can be inserted or deleted at arbitrary positions. By default, the first character in line number zero is positioned with its top left corner at the top left corner of the TextDisplay. The display is automatically updated following modifications to the text or when scrolling. Each character in the array has an associated text style. Operations are provided to apply, add, or remove font styles to a range of the text. TextDisplay can be used with both constant-width and proportionally-spaced fonts and with arbitrary geometric transformations. PUBLIC OPERATIONS
TextDisplay() ~TextDisplay(boolean autosized = false) Create or destroy a TextDisplay. If autosized is true, the TextDisplay will automatically grow its size as text is added. The default is to keep the size constant. void LineHeight(Coord lineheight) void TabWidth(Coord tabwidth) Lines of text will be positioned with baselines separated by lineheight. Tab characters in the text will cause the following char- acter to be positioned an integral multiple of tabwidth from the beginning of the line. void Resize(Coord xmin, Coord ymin, Coord xmax, Coord ymax) void Bounds(Coord& xmin, Coord& ymin, Coord& xmax, Coord& ymax) Specify or query the size of the display. Only lines of text that fall completely inside the specified region will be displayed. TextDisplay will not draw on any part of the canvas outside the specified bounds. Conversely, TextDisplay is free to draw on any part of the canvas within the specified bounds. void Draw(Painter*, Canvas*) Specify the painter and canvas to use for drawing operations; the painter specifies the font, colors, and geometric transformation. Draw should be called before performing any operation on the TextDisplay which produces output or requires graphical information, or when there is a possibility that the painter or canvas has changed since the function was last called. void Redraw(Coord left, Coord bottom, Coord right, Coord top) Redraw a specified region of the display. void Scroll(int line, Coord x, Coord y) Scroll the display so that line line is positioned with its upper-left corner at (x, y). There are no restrictions on the argu- ments: it is possible to scroll the display so that no lines are visible. void InsertLinesAfter(int line, int count) void InsertLinesBefore(int line, int count) void DeleteLinesAfter(int line, int count) void DeleteLinesBefore(int line, int count) Insert or delete whole lines of text. Line line is not affected by the operation. Other lines will move up or down to accommodate the changes. Newly inserted lines are blank. The specified line need not refer to an existing line. void InsertText(int line, int index, const char*, int count) void DeleteText(int line, int index, int count) void ReplaceText(int line, const char*, int count) Modify the text within line line. InsertText and DeleteText will cause the following characters on the line to move to accommodate the changes. ReplaceText replaces the entire text of the line. If the specified line is non-existent, a new line will be created. void Style(int line1, int index1, int line2, int index2, int style) void AddStyle(int line1, int index1, int line2, int index2, int style) void RemoveStyle(int line1, int index1, int line2, int index2, int style) Modify the styling of a range of text. Style replaces any existing style; AddStyle adds style style in addition to any existing styles; RemoveStyle removes style style without affecting other existing styles. Styles are specified as any combination of the constants Plain, Boldface, Underlined, and Reversed. void CaretStyle(int style) void Caret(int line, int index) Control the shape and position of a caret. Valid caret styles are currently NoCaret, BarCaret, UnderscoreCaret and OutlineCaret. TextDisplay does not automatically adjust the position of the caret following insertions and deletions. int LineNumber(Coord y) int LineIndex(int line, Coord x) Map x and y display coordinates into line and index text coordinates. LineNumber returns the number of the line that contains the specified vertical position y. LineIndex returns the index into line line that best corresponds to the specified horizontal posi- tion x. Coord Width() Coord Height() Return the width or the height of the text currently displayed by the TextDisplay. Width returns the width of the longest line in the display. Height returns the distance from the top of the topmost line to the bottom of the bottommost line. Note that these dimensions do not necessarily correspond to the TextDisplay's bounds as returned by Bounds. Coord Base(int line) Coord Top(int line) Coord Left(int line, int index) Coord Right(int line, int index) Map line and index text coordinates into x and y display coordinates. The return values define a bounding box for the character specified by line and index. SEE ALSO
Painter(2I), Canvas(2I) InterViews 23 May 1989 TextDisplay(3I)
All times are GMT -4. The time now is 04:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy