Sponsored Content
Top Forums Shell Programming and Scripting Cut determinate values amb subst for ; Post 302709325 by capilla on Wednesday 3rd of October 2012 05:49:43 AM
Old 10-03-2012
Hello Thanks for your reply. I try with the metodes and doesn't work :-(. The result is:
Code:
cut -d' ' -f2- file|paste -sd';\n' extractcritiques.txt
 host_name       cedf-ddt              ;       address         10.14.138.3
        host_name       dfb-crft             ;       address         10.14.184.2
        host_name       cesdneb-cerferu             ;       address         10.14.184.3
        host_name       cenfeeb-derfx;     address         10.14.139.10

Code:
awk 'FNR%2 {print name, $2;next}{name=$2}' OFS=';' extractcritiques.txt | more

;cdceb-adn
10.14.176.6;ceneb-fg
10.14.176.7;ceneb-arerfg
10.14.200.4;ceneb-arrefer
10.14.200.5;ceneb-brfer
10.14.244.96;ceneb-sacrf
10.14.244.97;ceneb-cacrf

I think the problem is the space in to the origen file:
Code:
    host_name       cendfseb-ardfdf
        address         10.14.176.6
        host_name       cesdfb-arsdf
        address         10.14.176.7
        host_name       csgb-atg
        address         10.14.200.4
        host_name       certhrteb-artg

Sorry in my first message don't appear the spaces (or tabulations) because I put in (Wrap quote). awk is very interesting. I'm read the documentation in this moment.

Last edited by Scrutinizer; 10-03-2012 at 07:01 AM.. Reason: code tags instead of quote tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command param subst to reg expression

I want to find out Row which starts with, the user specified details to a script. In general I know what command to be given. awk '$0~/^Vi/' BReject But I need to pass on $1 param of command line at the place of 'Vi'. I tried with -v subst=$1 awk -v subst=$1 '$0~/^subst/' BReject But it... (5 Replies)
Discussion started by: videsh77
5 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

Iterative statement to cut values from a line

Hi I am new to shell scripting and trying to get values from a text file, I have a text file with values seperated with "|". like aga|120220090525|120220090525|120220090525|120220090530 bab|120220090530|120220090530|120220090535|120220090535|120220090535... (4 Replies)
Discussion started by: mannepalli
4 Replies

4. UNIX for Dummies Questions & Answers

Parse or cut concat variables to individual values

Hello I need to pass some environment parameters to a datastage job and am getting an error when trying to send the complete concatinated variable. I have decided to parse out just the values and send as parameters but am struggling to find the best way to do this (actually I am not very... (3 Replies)
Discussion started by: LynnC
3 Replies

5. Shell Programming and Scripting

Delete character in determinate position with sed/awk

Hello. I'm trying to delete one character in determinate position. Example: qwEtsdf123Ecv34 <delete character in positión 3> Result: qwtsdf123Ecv34 Plase, help me. Thanks (4 Replies)
Discussion started by: maria_florencia
4 Replies

6. Shell Programming and Scripting

CSV with commas in field values, remove duplicates, cut columns

Hi Description of input file I have: ------------------------- 1) CSV with double quotes for string fields. 2) Some string fields have Comma as part of field value. 3) Have Duplicate lines 4) Have 200 columns/fields 5) File size is more than 10GB Description of output file I need:... (4 Replies)
Discussion started by: krishnix
4 Replies

7. UNIX for Dummies Questions & Answers

Cut from tables based on column values

Hello, I have a tab-delimited table that may contain 11,12 or 13 columns. Depending on the number of columns, I want to cut and get a sub table as shown below. However, the awk commands in the code seem to be an issue. What should I be doing differently? #cut columns 1-2,4-5,11 when 12 &... (3 Replies)
Discussion started by: Gussifinknottle
3 Replies

8. Shell Programming and Scripting

A simple variable subst is not working

Hi what i want: listing files in a special range ls -lrt 20120601{05..06}* ... -rw-rw-r-- 1 imp imp 279 1. Jun 07:51 201206010550 -rw-rw-r-- 1 imp imp 279 1. Jun 07:01 201206010600 -rw-rw-r-- 1 imp imp 279 1. Jun 07:11 201206010610 -rw-rw-r-- 1 imp imp 279 1. Jun 07:21... (1 Reply)
Discussion started by: IMPe
1 Replies

9. Shell Programming and Scripting

Using make subst

I have a string of source files ENBL_PX11_LIBSRC = pltsub.f xpltlib.f xbuplot.cI want to replace .f and .c with .o to get ENBL_PX11_LIBOBJ = pltsub.o xpltlib.o xbuplot.o However I am having trouble doing this with subst. (5 Replies)
Discussion started by: kristinu
5 Replies

10. Shell Programming and Scripting

Cut command with dynamic passing of delimiter and position values

Hi All, We have a requirement of picking nth position value by using cut command. value would be delimited by any symbols. We have to pass delimited value and postition to get the value in a string. ex. echo "A,B,C,D,E" |cut -d "," -f3 echo "A|B|C|D|E"|cut -d "|" -f2 Kindly frame the... (5 Replies)
Discussion started by: KK230689
5 Replies
MYSQLACCESS(1)						       MySQL Database System						    MYSQLACCESS(1)

NAME
mysqlaccess - client for checking access privileges SYNOPSIS
mysqlaccess [host_name [user_name [db_name]]] [options] DESCRIPTION
mysqlaccess is a diagnostic tool that Yves Carlier has provided for the MySQL distribution. It checks the access privileges for a host name, user name, and database combination. Note that mysqlaccess checks access using only the user, db, and host tables. It does not check table, column, or routine privileges specified in the tables_priv, columns_priv, or procs_priv tables. Invoke mysqlaccess like this: shell> mysqlaccess [host_name [user_name [db_name]]] [options] mysqlaccess supports the following options. o --help, -? Display a help message and exit. o --brief, -b Generate reports in single-line tabular format. o --commit Copy the new access privileges from the temporary tables to the original grant tables. The grant tables must be flushed for the new privileges to take effect. (For example, execute a mysqladmin reload command.) o --copy Reload the temporary grant tables from original ones. o --db=db_name, -d db_name Specify the database name. o --debug=N Specify the debug level. N can be an integer from 0 to 3. o --host=host_name, -h host_name The host name to use in the access privileges. o --howto Display some examples that show how to use mysqlaccess. o --old_server Assume that the server is an old MySQL server (before MySQL 3.21) that does not yet know how to handle full WHERE clauses. o --password[=password], -p[password] The password to use when connecting to the server. If you omit the password value following the --password or -p option on the command line, mysqlaccess prompts for one. Specifying a password on the command line should be considered insecure. See Section 6.1.2.1, "End-User Guidelines for Password Security". o --plan Display suggestions and ideas for future releases. o --preview Show the privilege differences after making changes to the temporary grant tables. o --relnotes Display the release notes. o --rhost=host_name, -H host_name Connect to the MySQL server on the given host. o --rollback Undo the most recent changes to the temporary grant tables. o --spassword[=password], -P[password] The password to use when connecting to the server as the superuser. If you omit the password value following the --spassword or -p option on the command line, mysqlaccess prompts for one. Specifying a password on the command line should be considered insecure. See Section 6.1.2.1, "End-User Guidelines for Password Security". o --superuser=user_name, -U user_name Specify the user name for connecting as the superuser. o --table, -t Generate reports in table format. o --user=user_name, -u user_name The user name to use in the access privileges. o --version, -v Display version information and exit. If your MySQL distribution is installed in some nonstandard location, you must change the location where mysqlaccess expects to find the mysql client. Edit the mysqlaccess script at approximately line 18. Search for a line that looks like this: $MYSQL = '/usr/local/bin/mysql'; # path to mysql executable Change the path to reflect the location where mysql actually is stored on your system. If you do not do this, a Broken pipe error will occur when you run mysqlaccess. COPYRIGHT
Copyright (C) 1997, 2014, Oracle and/or its affiliates. All rights reserved. This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. AUTHOR
Oracle Corporation (http://dev.mysql.com/). MySQL 5.5 01/30/2014 MYSQLACCESS(1)
All times are GMT -4. The time now is 09:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy