Sponsored Content
Full Discussion: awk - print new line
Top Forums Shell Programming and Scripting awk - print new line Post 302362933 by danmero on Sunday 18th of October 2009 10:19:46 PM
Old 10-18-2009
Quote:
Originally Posted by laco42
My task is to find the longest line in several files - that's not the problem
You just complicate your life Smilie
Code:
awk '{max=(max>NF)?max:NF}END{print max}' *

for any file in current directory
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk print line

Hi All, I know that i can print the lines from awk just using the print method, but i need to print stuff before it i.e: BEGIN { i=0 } { i++ print i ")" print } END { } Here the output is: (7 Replies)
Discussion started by: Chiefos
7 Replies

2. 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

3. 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

4. Shell Programming and Scripting

awk, Why does it print the same line twice?

awk '{print ; print '""'}' in.txt >inf.txt (2 Replies)
Discussion started by: cola
2 Replies

5. 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

6. UNIX for Dummies Questions & Answers

awk...print first line...

hello all, I am trying to use the AWK cmd on unix and trying to figre out how i can only print the first line and now rest of the line...so for example... $ lsnrctl version|grep Version| awk '{print $5}'| awk -F. '{print $1}'|uniq 11 NT Adapter for but i only want 11 to print out there... (3 Replies)
Discussion started by: abdul.irfan2
3 Replies

7. Shell Programming and Scripting

awk to print in a line

hi all, i have text file with sample text 01 02 .. abc .. def .. xyz .. x12 03 04 .. z123 .. x234 (6 Replies)
Discussion started by: posner
6 Replies

8. 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

9. Shell Programming and Scripting

awk print everything in new line

Hi, I have the following file and I would like to print everything to new line and the field seperator should be the dash (-). /usr/java/jdk1.6.0_30/bin/java -Dprogram.name=run.sh -server -XX:PermSize=512m -XX:MaxPermSize=512m -XX:NewSize=1g -XX:MaxNewSize=1g -Xmx3g -Xms3g... (3 Replies)
Discussion started by: kmaq7621
3 Replies

10. 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
apport-cli(1)						      General Commands Manual						     apport-cli(1)

NAME
apport-cli, apport-gtk, apport-kde - Apport user interfaces for reporting problems SYNOPSIS
apport-cli apport-cli [ --save file ] symptom | pid | package | program path | .apport/.crash file apport-cli -f apport-cli -f -p package -P pid apport-cli -u report-number Same options/arguments for apport-gtk and apport-kde. DESCRIPTION
apport automatically collects data from crashed processes and compiles a problem report in /var/crash/. This is a command line frontend for reporting those crashes to the developers. It can also be used to report bugs about packages or running processes. If symptom scripts are available, it can also be given the name of a symptom, or be called with just -f to display a list of known symp- toms. When being called without any options, it processes the pending crash reports and offers to report them one by one. You can also display the entire report to see what is sent to the software developers. When being called with exactly one argument and no option, apport-cli uses some heuristics to find out "what you mean" and reports a bug against the given symptom name, package name, program path, or PID. If the argument is a .crash or .apport file, it uploads the stored problem report to the bug tracking system. For desktop systems with a graphical user interface, you should consider installing the GTK or KDE user interface (apport-gtk or apport- kde). They accept the very same options and arguments. apport-cli is mainly intended to be used on servers. OPTIONS
-f, --file-bug Report a (non-crash) problem. If neither --package, --symptom, or --pid are specified, then it displays a list of available symp- toms. If none are available, it aborts with an error. This will automatically attach information about your operating system and the package version etc. to the bug report, so that the developers have some important context. -s symptom, --symptom=symptom When being used in --file-bug mode, specify the symptom to report the problem about. -p package, --package=package When being used in --file-bug mode, specify the package to report the problem against. -P pid, --pid=pid When being used in --file-bug mode, specify the PID (process ID) of a running program to report the problem against. This can be determined with e. g. ps -ux. -c report, --crash-file=report Upload a previously processed stored report in an arbitrary file location. This is useful for copying a crash report to a machine with internet connection and reporting it from there. Files must end in .crash or .apport. -u report-number, --update-report report-number Run apport information collection on an already existing problem report. The affected package is taken from the report by default, but you can explicitly specify one with --package to collect information for a different package (this is useful if the report is assigned to the wrong package). --save filename In --file-bug mode, save the collected information into a file instead of reporting it. This file can then be reported with --crash- file later on. -w, --window Point and click at the application window against which you wish to report the bug. Apport will automatically find the package name and generate a report for you. This option can be specially useful in situations when you do not know the name of the package, or if the application window has stopped responding and you cannot report the problem from the "Help" menu of the application. ENVIRONMENT
APPORT_IGNORE_OBSOLETE_PACKAGES Apport refuses to create bug reports if the package or any dependency is not current. If this environment variable is set, this check is waived. Experts who will thoroughly check the situation before filing a bug report can define this in their ~/.bashrc or temporarily when calling the apport frontend (-cli, -gtk, or -kde). FILES
/usr/share/apport/symptoms/*.py Symptom scripts. These ask a set of interactive questions to determine the package which is responsible for a particular problem. (For some problems like sound or storage device related bugs there are many places where things can go wrong, and it's not immedi- ately obvious for a bug reporter where the problem is.) AUTHOR
apport and the accompanying tools are developed by Martin Pitt <martin.pitt@ubuntu.com>. Martin Pitt August 01, 2007 apport-cli(1)
All times are GMT -4. The time now is 06:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy