Sponsored Content
Top Forums UNIX for Dummies Questions & Answers using Grep for only a certain number of columns Post 302166686 by MaestroRage on Tuesday 12th of February 2008 01:06:30 PM
Old 02-12-2008
using Grep for only a certain number of columns

I am given a file with a list of names for the first 20 characters. The 20 characters after is a list of names that somebody is supposed to team up with.

Now i'm trying to write a simple script that will read a name somebody inputs and then looks only in the first 20 characters.

For example. (Due to the nature of BBS posting length of columns are not given, the first name is the desired target for searching, the second name is the person teamed up with the first.

John Bow : Lucy Hemmings
Bob Billy : Bibliotheque Frenchness
Lucy Hemmings : John Bow

if somebody inputs John, I would get both Lucy and John, and this is not what I want. Any ideas?

I am considering piping grep -w with something else as it seems to at least cut out all the names which have no relevance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

number subtraction of multiple columns

I get the point of number subtraction in one column awk 'NR==1 {n=$1; next}; {n-=$1} END {print n}' inputfile but I cannot figure it out how to do this to multiple columns. awkward. (6 Replies)
Discussion started by: awkward
6 Replies

2. Shell Programming and Scripting

concatenate 'n' number of columns in a file

i have a file which may have 'n' number of columns 1 222 fafda 32 afdaf 4343 4343 234 43fdaf 4343 fdd fdfd fdfd fdd fdfd fdfd fdfd fdfd fdfd fdd fdfd fdfd need to concatenate the columns with... (3 Replies)
Discussion started by: mlpathir
3 Replies

3. Shell Programming and Scripting

How to subtract a number from all columns?

Hi, I want to subtract a number from all columns except the first column. I have a number of files each having different columns around 60/70. How to do that in awk or any other command? Thanks Input Col 1 Col 2 Col3 - - - - Col55 1 .0123 .098 - - - 0.6728 2 - -... (3 Replies)
Discussion started by: Surabhi_so_mh
3 Replies

4. Shell Programming and Scripting

Delete rows with particular number of columns

Hello Guys I have a flat file with few thousands of rows. Now each rows have different number of columns I want to delete the rows which has not equal to 749 columns Can you guys please let me know how to do the same Your help is much appreciated. (2 Replies)
Discussion started by: Pratik4891
2 Replies

5. Shell Programming and Scripting

Number of columns in xml file

How to find the number of columns in xml file. i tried following command. #!bin/ksh cat $1 | grep -c "</mdm:attribute>" exit 0 but i am not getting accurate result which is not matching with the manual count. data format : <mdm:attribute> value </mdm:attribute> (6 Replies)
Discussion started by: victory
6 Replies

6. Shell Programming and Scripting

How to check the number of columns in a line??

hi, i have a file with many records and each record may or may not have 6 columns. for example file1 : first second third fourth fifth sixth first second third fourth fifth first second third fourth fifth sixth first second third fourth fifth sixth seventh eigth if i cat the file and... (21 Replies)
Discussion started by: Little
21 Replies

7. Shell Programming and Scripting

Grep lines for number greater than given number

Hello, I am newbie to bash scripting. Could someone help me with the following. I have log file with output as shown below **************************LOG************************* 11/20/2013 9:11:23.64 Pinging xx.xx.xx.xx with 32 bytes of data: 11/20/2013 9:11:23.64 Reply from xx.xx.xx.xx:... (4 Replies)
Discussion started by: meena_2013
4 Replies

8. Shell Programming and Scripting

Request: How to Parse dynamic SQL query to pad extra columns to match the fixed number of columns

Hello All, I have a requirement in which i will be given a sql query as input in a file with dynamic number of columns. For example some times i will get 5 columns, some times 8 columns etc up to 20 columns. So my requirement is to generate a output query which will have 20 columns all the... (7 Replies)
Discussion started by: vikas_trl
7 Replies

9. Shell Programming and Scripting

Number of columns

Hi All I am using the below code to check the number of columns in a delimited file are same as expected. Code is give below awk -F '|' -v line=$2 'NF!=line {print NF,$0}' file Here the challenge is that , delimiter is different for each file, it can be pipe, comma, or semi colon.I want to... (4 Replies)
Discussion started by: ginrkf
4 Replies

10. Shell Programming and Scripting

Adding columns from 2 files with variable number of columns

I have two files, file1 and file2 who have identical number of rows and columns. However, the script is supposed to be used for for different files and I cannot know the format in advance. Also, the number of columns changes within the file, some rows have more and some less columns (they are... (13 Replies)
Discussion started by: maya3
13 Replies
UNAFS(8)                                                      System Manager's Manual                                                     UNAFS(8)

NAME
unafs - script to warn users about their weak passwords SYNOPSIS
unafs password-files cell-name DESCRIPTION
This manual page documents briefly the unafs command, which is part of the john package. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. john, better known as John the Ripper, is a tool to find weak passwords of users in a server. The unafs tool gets password hashes out of the binary AFS database, and produces a file usable by John. SEE ALSO
john(8), mailer(8), unique(8), unshadow(8). The programs are documented fully by John's documentation, which should be available in /usr/share/doc/john or other location, depending on your system. AUTHOR
This manual page was written by Jordi Mallach <jordi@debian.org>, for the Debian GNU/Linux system (but may be used by others). John the Ripper and mailer were written by Solar Designer <solar@openwall.com>. The complete list of contributors can be found in the CRED- ITS file in the documentation directory. john June 03, 2004 UNAFS(8)
All times are GMT -4. The time now is 06:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy