Sponsored Content
Top Forums Shell Programming and Scripting !!EMERGENCY!! - GREP/CUT to array Post 302448021 by Scrutinizer on Wednesday 25th of August 2010 04:49:02 AM
Old 08-25-2010
By default awk separates using space characters so it will handle to TABs as well as space. To make it e.g. use TABs only you can use:
Code:
awk -F "\t" 'NR==5{print $4}' infile

likewise for . or ,
Code:
awk -F. 'NR==5{print $4}' infile
awk -F, 'NR==5{print $4}' infile

To use any number of space characters only (and not TABs):
Code:
awk -F" *" NR==5{print $4}' infile

This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep and cut....

hi, i have a simple question: in hpux 11i; this cmd : cat mailtest |grep sekar >test1 gives the output file with the name test1. i want to remove the line which contains the "sekar" and put the result in the new file.... what is the command for that?.. (2 Replies)
Discussion started by: sekar sundaram
2 Replies

2. UNIX for Dummies Questions & Answers

to assign cut values to an array

i need to seperate values seperated by delimiters and assign it to an array.. can u plz help me on that. Variables = "asd,rgbh,(,rty,got,),sroe,9034," i need to assign the variables into arrays.. like.. var=asd var=rgbh.. and so on how do i do this. i need to reuse the values stored in... (6 Replies)
Discussion started by: Syms
6 Replies

3. Shell Programming and Scripting

tail, grep and cut

Hello all, I have some weird problem that kinda baffles me. Say I have the following test file: claudia:~/tmp$ cat testfile.txt This is a test line This is the second test line And yeah, this is the third test line Then say I want to tail the file, grep for the word "third" then... (7 Replies)
Discussion started by: sylaan
7 Replies

4. Shell Programming and Scripting

Perl grep array against array

Hi, Is there any way I can grep an array against another array? Basically here's what I need to do. There will be an array containing some fixed texts and I have to check whether some files contain these lines. Reading the same files over and over again for each different pattern doesnt seem... (1 Reply)
Discussion started by: King Nothing
1 Replies

5. Shell Programming and Scripting

Using grep and cut within awk

Hi My input file looks like as follows: say a.txt "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss... (5 Replies)
Discussion started by: bittoo
5 Replies

6. Slackware

How should I cut this line using cut and grep?

not sure how to do it. wan't to delete it using cut and grep ince i would use it in the shell. but how must the command be? grep "64.233.181.103 wwwGoogle.com" /etc/hosts | cut -d the delimeter is just a space. can you help meplease. :D (1 Reply)
Discussion started by: garfish
1 Replies

7. Shell Programming and Scripting

Cut text and assign them into array

file.txt : is delimiter: abc:def:ghi jkl:mno: pqr 123:456:789 if I do the cut command, and cut the first column, and echo it out I will get the output: abc jkl 123 How can I assign the column of text that I've cut into Array? e.g If I were to echo array array it will output as:... (9 Replies)
Discussion started by: andylbh
9 Replies

8. Shell Programming and Scripting

grep with cut option??

This is my command-line code in my script, passwd=`grep $passwd $userfile | cut -f2 -d: login_users > retrieve` the cut -f2 -d: login_users > retrieve searches and prints the whole column two. what I need is one of the items in the column two only.. what option can I add to my cut... (2 Replies)
Discussion started by: jenimesh19
2 Replies

9. Shell Programming and Scripting

Cut Lines using grep

Hi, I have a SQL script with "create table" and "alter table" statements and I want to cut all the alter table statements from original file (A) and move it to a different file (B). Can you please me the option. Thanks a lot for your time. (3 Replies)
Discussion started by: bhupinder08
3 Replies

10. Shell Programming and Scripting

Emergency grep/delete trouble!!!

Hi everyone, thank you so much for reading. I built a user reference page from /etc/password for a class project. Now I need two shell scripts: 1) Add names to the reference page 2) Delete names from the reference page. I know grep -v is involved somehow and some piping but I am super stuck. ... (1 Reply)
Discussion started by: jsmpdx
1 Replies
ttk::notebook(n)						 Tk Themed Widget						  ttk::notebook(n)

__________________________________________________________________________________________________________________________________________________

NAME
ttk::notebook - Multi-paned container widget SYNOPSIS
ttk::notebook pathname ?options...? pathname add window ?options...? pathname insert index window ?options...? _________________________________________________________________ DESCRIPTION
A ttk::notebook widget manages a collection of windows and displays a single one at a time. Each slave window is associated with a tab, which the user may select to change the currently-displayed window. STANDARD OPTIONS
-class -cursor -takefocus -style See the ttk_widget manual entry for details on the standard options. WIDGET-SPECIFIC OPTIONS [-height height] If present and greater than zero, specifies the desired height of the pane area (not including internal padding or tabs). Otherwise, the maximum height of all panes is used. [-padding padding] Specifies the amount of extra space to add around the outside of the notebook. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left. [-width width] If present and greater than zero, specifies the desired width of the pane area (not including internal padding). Otherwise, the maximum width of all panes is used. TAB OPTIONS
The following options may be specified for individual notebook panes: [-state state] Either normal, disabled or hidden. If disabled, then the tab is not selectable. If hidden, then the tab is not shown. [-sticky sticky] Specifies how the slave window is positioned within the pane area. Value is a string containing zero or more of the characters n, s, e, or w. Each letter refers to a side (north, south, east, or west) that the slave window will "stick" to, as per the grid geometry manager. [-padding padding] Specifies the amount of extra space to add between the notebook and this pane. Syntax is the same as for the widget -padding option. [-text text] Specifies a string to be displayed in the tab. [-image image] Specifies an image to display in the tab. See ttk_widget(n) for details. [-compound compound] Spec- ifies how to display the image relative to the text, in the case both -text and -image are present. See label(n) for legal values. [-underline underline] Specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation if ttk::notebook::enableTraversal is called. TAB IDENTIFIERS
The tabid argument to the following commands may take any of the following forms: o An integer between zero and the number of tabs; o The name of a slave window; o A positional specification of the form "@x,y", which identifies the tab o The literal string "current", which identifies the currently-selected tab; or: o The literal string "end", which returns the number of tabs (only valid for "pathname index"). WIDGET COMMAND
pathname add window ?options...? Adds a new tab to the notebook. See TAB OPTIONS for the list of available options. If window is currently managed by the notebook but hidden, it is restored to its previous position. pathname configure ?options? See ttk::widget(n). pathname cget option See ttk::widget(n). pathname forget tabid Removes the tab specified by tabid, unmaps and unmanages the associated window. pathname hide tabid Hides the tab specified by tabid. The tab will not be displayed, but the associated window remains managed by the notebook and its configuration remembered. Hidden tabs may be restored with the add command. pathname identify component x y Returns the name of the element under the point given by x and y, or the empty string if no component is present at that location. The following subcommands are supported: pathname identify element x y Returns the name of the element at the specified location. pathname identify tab x y Returns the index of the tab at the specified location. pathname index tabid Returns the numeric index of the tab specified by tabid, or the total number of tabs if tabid is the string "end". pathname insert pos subwindow options... Inserts a pane at the specified position. pos is either the string end, an integer index, or the name of a managed subwindow. If subwindow is already managed by the notebook, moves it to the specified position. See TAB OPTIONS for the list of available options. pathname instate statespec ?script...? See ttk::widget(n). pathname select ?tabid? Selects the specified tab. The associated slave window will be displayed, and the previously-selected window (if different) is unmapped. If tabid is omitted, returns the widget name of the currently selected pane. pathname state ?statespec? See ttk::widget(n). pathname tab tabid ?-option ?value ... Query or modify the options of the specific tab. If no -option is specified, returns a dictionary of the tab option values. If one -option is specified, returns the value of that option. Otherwise, sets the -options to the corresponding values. See TAB OPTIONS for the available options. pathname tabs Returns the list of windows managed by the notebook. KEYBOARD TRAVERSAL
To enable keyboard traversal for a toplevel window containing a notebook widget $nb, call: ttk::notebook::enableTraversal $nb This will extend the bindings for the toplevel window containing the notebook as follows: o Control-Tab selects the tab following the currently selected one. o Shift-Control-Tab selects the tab preceding the currently selected one. o Alt-K, where K is the mnemonic (underlined) character of any tab, will select that tab. Multiple notebooks in a single toplevel may be enabled for traversal, including nested notebooks. However, notebook traversal only works properly if all panes are direct children of the notebook. VIRTUAL EVENTS
The notebook widget generates a <<NotebookTabChanged>> virtual event after a new tab is selected. EXAMPLE
pack [ttk::notebook .nb] ttk::notebook::enableTraversal .nb SEE ALSO
ttk::widget(n), grid(n) KEYWORDS
pane, tab Tk 8.5 ttk::notebook(n)
All times are GMT -4. The time now is 01:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy