Sponsored Content
Top Forums Shell Programming and Scripting printing a line number using awk Post 302087475 by rjsha1 on Friday 1st of September 2006 09:09:18 AM
Old 09-01-2006
Hi blowtorch,
thats great - Ihave another question what happens if does not have a space and it just ,, or is , - which means the end of the line I have tried "" but it does nit like that
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Printing a specific line using AWK

Hi, I have a script that fetches only specific information from fcinfo command. Below is a portion of the script. #!/usr/bin/ksh set -x HBA_COUNT=`sudo fcinfo hba-port | grep -i state | awk 'END{print NR}'` echo "$HBA_COUNT HBAs exist" echo '........' INDEX=1 while $INDEX -le... (2 Replies)
Discussion started by: jake_won
2 Replies

2. Shell Programming and Scripting

printing line number

hi, i have a file, i need to search for a string , if the line contains i need to print that line number and line , please help thanks in advance Satya (5 Replies)
Discussion started by: Satyak
5 Replies

3. Shell Programming and Scripting

regarding about printing line number

Hello, I am testing some data to get line number at cursor position 9 and found some problem, the code is below.Assume we got 3 attribute. At second attribute, there are some data(eg.A41/A6) missing like at the fourth and six line 11006 A41 1888 11006 ... (7 Replies)
Discussion started by: davidkhan
7 Replies

4. Shell Programming and Scripting

Printing the line number in bash script

Hi, I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened. Thanks, (6 Replies)
Discussion started by: suryaemlinux
6 Replies

5. Shell Programming and Scripting

Printing the line number of first column found

Hello, I have a question on how to find the line number of the first column that contains specific data. I know how to print all the line numbers of those columns, but haven't been able to figure out how to print only the first one that is found. For example, if my data has four columns: 115... (3 Replies)
Discussion started by: user553
3 Replies

6. Shell Programming and Scripting

Printing Number of Fields with the line number

Hi, How to print the number of fields in each record with the line number? Lets saw I have 3212|shipped|received| 3213|shipped|undelivered| 3214|shipped|received|delivered I tried the code awk -F '|' '{print NF}' This gives me ouput as 3 3 4 (5 Replies)
Discussion started by: machomaddy
5 Replies

7. Shell Programming and Scripting

Matching and printing line with awk

Hi there, I'm trying to use awk to print out the entire line that contains a match to a certain regex and then append some text,plus the match to the end of the line. So far I have: awk -F: '{print "RG:Z:" $2}' file Which prints out the match I want plus the additional text, but I'm stuck... (3 Replies)
Discussion started by: jim_lad
3 Replies

8. Shell Programming and Scripting

awk to find number in a field then print the line and the number

Hi I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field. The source file is pipe delimited and looks something like 1|net|ABC Letr1|1530||| 1|net|EXP_1040 ABC|1121||| 1|net|EXP_TG1224|1122||| 1|net|R_North|1123|||... (5 Replies)
Discussion started by: Mudshark
5 Replies

9. Shell Programming and Scripting

awk printing output to new line

Hi I have a file profile.txt with the below input: {"atgUserId":"736f14c4-eda2-4531-9d40-9de4d6d1fb0f","firstName":"donna","lastName":"biehler","email":"schoolathome42@live.com","receiveEmail":"y es"}, {"atgUserId":"c3716baf-9bf8-42da-8a44-a13fff68d20f","firstName":"Gilberto... (6 Replies)
Discussion started by: ankur328
6 Replies

10. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
JOIN(1) 						      General Commands Manual							   JOIN(1)

NAME
join - relational database operator SYNOPSIS
join [ options ] file1 file2 DESCRIPTION
Join forms, on the standard output, a join of the two relations specified by the lines of file1 and file2. If file1 is `-', the standard input is used. File1 and file2 must be sorted in increasing ASCII collating sequence on the fields on which they are to be joined, normally the first in each line. There is one line in the output for each pair of lines in file1 and file2 that have identical join fields. The output line normally con- sists of the common field, then the rest of the line from file1, then the rest of the line from file2. Fields are normally separated by blank, tab or newline. In this case, multiple separators count as one, and leading separators are dis- carded. These options are recognized: -an In addition to the normal output, produce a line for each unpairable line in file n, where n is 1 or 2. -e s Replace empty output fields by string s. -jn m Join on the mth field of file n. If n is missing, use the mth field in each file. -o list Each output line comprises the fields specified in list, each element of which has the form n.m, where n is a file number and m is a field number. -tc Use character c as a separator (tab character). Every appearance of c in a line is significant. SEE ALSO
sort(1), comm(1), awk(1) BUGS
With default field separation, the collating sequence is that of sort -b; with -t, the sequence is that of a plain sort. The conventions of join, sort, comm, uniq, look and awk(1) are wildly incongruous. 7th Edition April 29, 1985 JOIN(1)
All times are GMT -4. The time now is 06:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy