Sponsored Content
Full Discussion: Perl: Separator
Top Forums Shell Programming and Scripting Perl: Separator Post 302334441 by KevinADC on Wednesday 15th of July 2009 02:06:35 PM
Old 07-15-2009
Quote:
Originally Posted by sighK
don't use $/

try reading whole thing as a string, use split to get whwat you need instead

$/ is for cutting streams. It isn't even a string until you place it into a register.
or use it to slurp the whole file into a variable.

Example

open (FILE, "$filename");
local $/;
$file=<FILE>;
close(FILE);

#the entire file is in one variable including the [
@file=split("[", $file);
#now it is in an array.
I am pretty sure that is going to do the exact same thing he is already doing.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Separator in Makefile?

all: $(LIBRARY) $(EXE) $(MAKEMAKE): @rm -f $(MAKEMAKE) $(PURIFY) $(CXX) -M $(INCLUDE) $(CPPFLAGS) *.cpp > $(MAKEMAKE) $(EXE): $(OBJS) $(LIBRARY) @echo "Creating a executable " $(PURIFY) $(CC) -o $(EXE) $(OBJS) $(ALLLDFLAGS) $(LIBS) This is a snippet... (2 Replies)
Discussion started by: laila63
2 Replies

2. UNIX for Dummies Questions & Answers

Help with unix separator

can some one give me a list of unix separtor(s) if one than just the separator please thank you. (2 Replies)
Discussion started by: Black mage2021
2 Replies

3. Shell Programming and Scripting

field separator in Perl

is there a similar parameter you can set in perl like FS in awk? I think I've read all the tutorials on the subject, but cannot get this map split and so on thing to work. I need to sort a file by columns, eg. first, third, fifth... The script I need to add this column sorting is this: use... (38 Replies)
Discussion started by: ahsog
38 Replies

4. Shell Programming and Scripting

Using > as record separator

I have tried to use ">" as record separator, but it doesn't work. I have tried this: awk BEGIN{RS=">"}'{print $0}' input output: awk: BEGIN{RS=>}{print $0} awk: ^ syntax error awk BEGIN{RS="\>"}'{print $0}' input awk: BEGIN{RS=\>}{print $0} awk: ^ backslash not... (2 Replies)
Discussion started by: locoroco
2 Replies

5. Shell Programming and Scripting

Field separator X'1F'

Hi, I have a flat file with fields separated by a X'1F' i have to fetch 4th field from second line. please help me how to achieve it. I tried with below command and its not working. cut -f4 -d`echo -e '\x1f'` filename.txt I am using SunOS. Thanks in advance. (2 Replies)
Discussion started by: rohan10k
2 Replies

6. Shell Programming and Scripting

Command Separator

It shows error at 'else', how can I fix it? if ; then # Note the space after the semicolon. #+ ^^ echo "File $filename exists."; cp $filename $filename.bak else # ^^ echo "File $filename not found."; touch $filename fi; echo "File test complete." (3 Replies)
Discussion started by: Qazi
3 Replies

7. Shell Programming and Scripting

Row separator

Hello All, I need help with the below, I would appreciate any tip. I have a file as below Input file Apple: Green Banana: Yellow Grapes: Black Apple: Red Banana: Green Grapes: Green Grapes: Brown Apple: Pale Red Banana: Greenish yellow Grapes: Brown Apple: Yellowish... (14 Replies)
Discussion started by: m6248m
14 Replies

8. Shell Programming and Scripting

Field separator

Hello All, I have a file, but I want to separate the file at a particular record with comma"," in the line Input file APPLE6SSAMSUNGS5PRICEPERPIECEDOLLAR600EACH010020340URX581949695US to Output file APPLE6S,SAMSUNGS5,PRICEPERPIECE,DOLLAR600EACH,010020340URX581949695,US This is for... (11 Replies)
Discussion started by: m6248m
11 Replies

9. Shell Programming and Scripting

Awk, with separator |

Friends have the following code that is correct. BEGIN { num_reg = 0 suma_iva=0 } { num_reg++ suma_iva=suma_iva+int(substr($0, 103,9)) } END{ printf ("%011d",suma_iva) } I have the following problem, I have to do just that but this time... (4 Replies)
Discussion started by: tricampeon81
4 Replies

10. Shell Programming and Scripting

Separator

Hello everybody, I'll get one more help I have a cabundle file that I need to separate into 2 parts, the first sequence and the second sequence, I thought of several things but I did not remember anything that could actually accomplish this separation and transform into 2 variables, first... (4 Replies)
Discussion started by: c0i0t3
4 Replies
dialogshell(1)							  [incr Widgets]						    dialogshell(1)

__________________________________________________________________________________________________________________________________________________

NAME
dialogshell - Create and manipulate a dialog shell widget SYNOPSIS
dialogshell pathName ?options? INHERITANCE
itk::Toplevel <- Shell <- Dialogshell STANDARD OPTIONS
background cursor foreground See the "options" manual entry for details on the standard options. INHERITED OPTIONS
height master modality width See the "shell" manual entry for details on the above inherited options. title See the "Toplevel" manual entry for details on the above inherited options. WIDGET-SPECIFIC OPTIONS Name: buttonBoxPadX Class: Pad Command-Line Switch: -buttonboxpadx Specifies a non-negative padding distance to leave between the button group and the outer edge of the button box in the x direction. The value may be given in any of the forms accpetable to Tk_GetPixels. The default is 5 pixels. Name: buttonBoxPadY Class: Pad Command-Line Switch: -buttonboxpady Specifies a non-negative padding distance to leave between the button group and the outer edge of the button box in the y direction. The value may be given in any of the forms accpetable to Tk_GetPixels. The default is 5 pixels. Name: buttonBoxPos Class: Position Command-Line Switch: -buttonboxpos Attaches buttons to the given side of the dialog: n, s, e or w. The default is s. Name: padX Class: Pad Command-Line Switch: -padx Specifies a padding distance for the childsite in the X-direction in any of the forms acceptable to Tk_GetPixels. The default is 10. Name: padY Class: Pad Command-Line Switch: -pady Specifies a padding distance for the childsite in the Y-direction in any of the forms acceptable to Tk_GetPixels. The default is 10. Name: separator Class: Separator Command-Line Switch: -separator Specifies whether a line is drawn to separate the buttons from the dialog box contents in any of the forms acceptable to Tcl_Get- Boolean. The default is true. Name: thickness Class: Thickness Command-Line Switch: -thickness Specifies the thickness of the separator in any of the forms acceptable to Tk_GetPixels. The default is 3 pixels. __________________________________________________________________________________________________________________________________________________ DESCRIPTION
The dialogshell command creates a dialog shell which is a top level widget composed of a button box, separator, and child site area. The class also has methods to control button construction. METHODS
The dialogshell command create a new Tcl command whose name is pathName. This command may be used to invoke various operations on the wid- get. It has the following general form: pathName option ?arg arg ...? Option and the args determine the exact behavior of the command. The following commands are possible for dialogshell widgets: INHERITED METHODS
activate center deactivate See the "shell" manual entry for details on the above inherited methods. ASSOCIATED METHODS
add buttonconfigure defaultdelete hide index insert invoke show See the "buttonbox" manual entry for details on the associated methods. WIDGET-SPECIFIC METHODS pathName cget option Returns the current value of the configuration option given by option. Option may have any of the values accepted by the dialogshell command. pathName childsite Returns the pathname of the child site widget. pathName configure ?option? ?value option value ...? Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the dialogshell command. COMPONENTS
Name: dschildsite Class: frame The dschildsite component is the user child site for the dialog shell. See the "frame" widget manual entry for details on the dschildsite component item. Name: separator Class: frame The separator component devides the area between the user child site and the button box. See the "frame" widget manual entry for details on the separator component item. Name: bbox Class: ButtonBox The bbox component is the button box containing the buttons for the dialog shell. See the "ButtonBox" widget manual entry for details on the bbox component item. EXAMPLE
dialogshell .ds -modality none .ds add OK -text "OK" .ds add Cancel -text "Cancel" .ds default OK .ds activate AUTHOR
Mark L. Ulferts KEYWORDS
dialogshell, dialog, shell, widget Tk dialogshell(1)
All times are GMT -4. The time now is 12:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy