Sponsored Content
Top Forums Shell Programming and Scripting Print filename and last line using awk Post 302726057 by ripat on Saturday 3rd of November 2012 01:08:28 PM
Old 11-03-2012
Windows files with CRLF?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print any required line by its line no using awk and its NR variable

how to print any required line by its line no using awk and its NR variable for eg: ------------ 121343 adfdafd 21213sds dafadfe432 adf.adf%adf --------------- requied o/p if give num=3 it print: 21213sds -------------------------------------- (2 Replies)
Discussion started by: RahulJoshi
2 Replies

2. Shell Programming and Scripting

awk print the next line on the current line

Ok I have a file with hundreds of lines, four columns, space delimited, TESTB.TXT for example TESTB.TXT --- AA ZZ 12 34 BB YY 56 78 CC XX 91 23 DD VV 45 67 --- I want a new file that has 7 columns, the first four are identical, and the next 3 are the last three of the next line...so... (5 Replies)
Discussion started by: ajp7701
5 Replies

3. Shell Programming and Scripting

Howto Print File Path or Print the Filename

I'm trying to clean up my samba share and need to print the found file or print the path of the image it tried to searched for. So far I have this but can't seem to get the logic right. Can anyone help point me in the right direction? for FILE in `cat list`; do if ; then ... (1 Reply)
Discussion started by: overkill
1 Replies

4. Shell Programming and Scripting

awk to print on the same line

Hi all, I've a script that uses awk to parse the output of wget during a database update. The code I use is: wget -c ftp://ftpsite/file 2>&1 | awk '/0%/ {print}'But this spits out each progress line on a new line: 37250K .......... .......... .......... .......... .......... 80% 10.9M 1s ... (2 Replies)
Discussion started by: euval
2 Replies

5. Shell Programming and Scripting

Print filename with awk

I can got the filename with this script. it's only show "-" in result. cut -d , -f7 CSV_d.* | awk 'OFS=":"{print FILENAME,substr($1,1,8),substr($1,9,2),substr($1,11,2),substr($1,13,2)}' | sort |uniq (2 Replies)
Discussion started by: before4
2 Replies

6. Shell Programming and Scripting

awk script -print line when $2 > $2 of previous line

Hi all, From a while loop I am reading a sorted file where I want to print only the lines that have $1 match and $2 only when the difference from $2 from the previous line is > 30. Input would be like ... AN237 010 193019 0502 1 CSU Amoxycillin AN237 080 ... (2 Replies)
Discussion started by: gafoleyo73
2 Replies

7. UNIX for Advanced & Expert Users

Problem piping find output to awk, 1st line filename is truncated, other lines are fine.

Today I needed to take a look through a load of large backup files, so I wrote the following line to find them, order them by size, and print the file sizes in GB along with the filename. What happened was odd, the output was all as expected except for the first output line which had the filename... (4 Replies)
Discussion started by: gencon
4 Replies

8. Shell Programming and Scripting

awk to print the line that matches and the next if line is wrapped

I have a file and when I match the word "initiators" in the first column I need to be able to print the rest of the columns in that row. This is fine for the most part but on occasion the "initiators" line gets wrapped to the next line. Here is a sample of the file. caw-enabled ... (3 Replies)
Discussion started by: kieranfoley
3 Replies

9. Shell Programming and Scripting

Use while loop to read file and use ${file} for both filename input into awk and as string to print

I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix. I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice. Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

10. UNIX for Beginners Questions & Answers

awk to print filename words along with delimiter

Hi, I have filename as: 010020001_S-FOR-Sort-SYEXC_20180109_062320_0100.x937 I need first 5 words of my filename along with the respective delimiters: I tried this: f=010020001_S-FOR-Sort-SYEXC_20180109_062320_0100.x937 echo $f | awk -F '' '{print $1$2$3$4$5}' 010020001SFORSortSYEXC ... (11 Replies)
Discussion started by: gnnsprapa
11 Replies
DOCDIFF(1)						      General Commands Manual							DOCDIFF(1)

NAME
docdiff -- character/word-oriented diff SYNOPSIS
docdiff [options] file1 file2 DESCRIPTION
This manual page documents briefly the docdiff commands. This manual page was written for the Debian distribution because the original program does not have a manual page. Instead, it has docu- mentation in the HTML format; see below. docdiff is a program that compares two files and shows the difference. It can compare files word by word, char by char, or line by line. It has several output formats such as HTML/XHTML, tty, Manued, or user-defined markup. It supports several encodings and end-of-line characters, including ASCII, UTF-8, EUC-JP, Shift_JIS, CR, LF, and CRLF. OPTIONS
--resolution=RESOLUTION specify resolution (granularity) line|word|char (default is word) --line set resolution to line --word set resolution to word --char set resolution to char --encoding=ENCODING specify character encoding ASCII|EUC-JP|Shift_JIS|UTF-8|auto (default is auto) --ascii same as --encoding=ASCII --eucjp same as --encoding=EUC-JP --sjis same as --encoding=Shift_JIS --utf8 same as --encoding=UTF-8 --eol=EOL specify end-of-line character CR|LF|CRLF|auto (default is auto) --cr same as --eol=CR --lf same as --eol=LF --crlf same as --eol=CRLF --format=FORMAT specify output format tty|manued|html|wdiff|user (default is html; user tags have to be described in config file) --tty same as --format=tty --manued same as --format=manued --html same as --format=html --wdiff same as --format=wdiff --digest digest output, do not show all --cache use file cache --no-config-file do not read config files --verbose run verbosely --help show usage --version show version --license show license --author show author(s) SEE ALSO
/usr/share/doc/docdiff/readme.html. AUTHOR
This manual page was written by akira yamada akira@debian.org for the Debian system (but may be used by others). DOCDIFF(1)
All times are GMT -4. The time now is 01:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy