Sponsored Content
Full Discussion: Adding in Awk
Top Forums Shell Programming and Scripting Adding in Awk Post 302614209 by Leo_Boon on Wednesday 28th of March 2012 10:45:27 AM
Old 03-28-2012
Thanks. How can I do it iteratively? Say, every line with one 4 lines ahead of it?

---------- Post updated at 03:45 PM ---------- Previous update was at 03:34 PM ----------

I hadn't refreshed and I hadn't seen the post above mine before posting...
What does [NR%5] mean?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Adding a new field using sed or awk?

I have a bcp file that contains 10 fields. These fields are separated by a tab. How can I add my name as a new field in the 8th position for every record? I've been playing w/ sed and awk but can't seem to figure this out. (3 Replies)
Discussion started by: sasabune
3 Replies

2. Shell Programming and Scripting

Help with awk adding spaces.

I have a file that contains... elm,mail elm,lisp,composer,cd,ls,cd,ls,cd,ls,zcat,|,tar,-xvf,ls,cd,ls,cd,ls,vi,ls,cd,ls,vi,elm,-f,ls,rm,ls,cd,ls,vi,vi,ls,vi,ls,cd,ls,elm,cd,ls,cd,ls,vi,vi,vi,ls,vi,ls,i,vi,ls,cp,cd,fg,ls,rm,cd,ls,-l,exit elm,mail,biff,elm,biff,elm,elm elm,ls ... (2 Replies)
Discussion started by: Bandit390
2 Replies

3. Shell Programming and Scripting

awk-adding a column to a file

Hello Friends, i used awk to sum up total size of files under a directory (with the help of examples, threads here). ls -l | awk '/^-/ {total += $5} END {printf "%15.0f\n",total}' >> total.txt After each execution of the script total result is appended into a text file: 7010 7794 8890 ... (7 Replies)
Discussion started by: EAGL€
7 Replies

4. UNIX for Dummies Questions & Answers

Adding date when using awk

Hi, I want to print the number of lines of a file along with filename and today's date. Ex: XXX|07-22-2010|8 I am using as wc -c -l file.txt | awk '{print "XXX|",date +"%m-%d-%Y","|",$1}' But this one prints as AAA| 0 | 8 Can anyone please help me on this for printing the date? ... (3 Replies)
Discussion started by: aeroticman
3 Replies

5. Shell Programming and Scripting

Adding column using awk

Hello everyone, I have a file with the following structure: abc xyz 111 222 agf hjhf 787 799 tht yah 878 898 ... ... ... ... ... ... ... ... ... ... ... ... I want to add a column (with a fixed value of 1000) at the end such that it becomes: abc xyz 111 222 1000 agf hjhf 787... (5 Replies)
Discussion started by: ad23
5 Replies

6. Shell Programming and Scripting

Adding A Bump of Numbers with Awk

ok, so i have a bunch of numbers in a file that i'd like to add up. i dont know how to do it. This is how far i've gotten: echo "4 4 5 4 3 4 3 3 4 2 43 3 293 49 23" | sed 's/ / + /g' | awk -F" " I dont want to use the expr command with this as i dont trust it. any advice? thanks (1 Reply)
Discussion started by: SkySmart
1 Replies

7. Shell Programming and Scripting

adding a number with sed or awk.

Hi.. I have this delicate problem..:wall: I have this huge ldif file with entry's like this example below.. And I need to change the following entrys. telephoneNumber: emNotifNumber: billingnumber= BillingNumber: Al these entrys has a number like 012345678 and it needs to add one more... (15 Replies)
Discussion started by: pelama
15 Replies

8. Shell Programming and Scripting

Adding a specified value to a specified column - awk?

Hi everyone! I sometimes need to do some simple arithmetics, like adding a number to a certain column of a file. So I wrote a small function in the .bashrc file, which looks like this shifter() { COL=$1 VAL=$2 FILE=$3 cp $FILE $FILE.shifted awk 'NF==4 {$(( $COL )) = $(( $COL ))... (6 Replies)
Discussion started by: radudownload
6 Replies

9. Shell Programming and Scripting

Awk: adding fields after matching $1

Dear AWK-experts! I did get stuck in the task of combining files after matching fields, so I'm still awkward with learning AWK. There are 2 files: one containing 3 columns with ID, coding status, and score for long noncoding RNAs: file1 (1.txt) (>5000 lines) ... (12 Replies)
Discussion started by: kben
12 Replies

10. Shell Programming and Scripting

Adding tags in between sentences with awk

Hi, I need an awk to modify the following file. It is 2-column tab-separated. Hi PP my VBD name DT is NN . SENT Her PP name VBD is DT the NN same WRT . SENT <s> Hi PP - (6 Replies)
Discussion started by: owwow14
6 Replies
ROOTTAIL(1)						      General Commands Manual						       ROOTTAIL(1)

NAME
root-tail - print text directly to X11 root window SYNOPSIS
root-tail [-g|--geometry GEOMETRY] [-fn|--font FONTSPEC] [--color color] [--reload SEC COMMAND] [--shade] [--outline] [--minspace] [--noflicker] [-f|--fork] [--reverse] [--whole] [--partial] [--update] [--cont STRING] [--wordwrap] [--justify] [--noinitial] [--frame] [-id ID] [-i|--interval SECONDS] [-V] file1[,color[,desc]] [file2[,color[,desc]]] DESCRIPTION
Displays a given file anywhere on your X11 root window, i.e. it is kind of tail -f for multiple files using your desktop background as out- put window. All non-option arguments on the command line are files to be logged. A null desc (example: "/var/log/messages,red,") will prevent the printing of a description and the []'s. General Options --color COLOR Use COLOR as default. --font | -fn FONTSPEC Use font FONTSPEC. This can be either a fixed width font like -fn fixed or any font using -fn '-*-*-*-*-*-*-*-*-*-*-*-*-*-*' with the appropriate fields filled out (see xfontsel). Specifying a different FONTSPEC before each filename will cause each file to be displayed in a different font. -f | --fork Forks to the background. --reverse Display the files in reverse order, with the newest lines at the top. --whole Only display whole lines. If the last line of a file doesn't yet end with a newline character then wait until it does before dis- playing it. This is the default if more than one file is being displayed. --partial This is the opposite of the --whole option (see above). It displays lines even if they don't yet have a newline at the end. This is the default if only one file is being displayed. --update Update partial lines 'in place' if they are still on the screen when they are updated in their files. Using --update automatically turns on --partial. --cont STRING When partial lines are broken into two lines in the display, prefix the 2nd line with STRING. Defaults to "|| ". Specify the "--whole" argument to ensure partial lines are never displayed, or specify "--update" to attempt to "repair" broken lines in-place. --cont-color COLOR Use COLOR when displaying the continuation string (as optionally specified with the --cont option above). --wordwrap The default behaviour is to fit as much as possible onto each line of output, even if this means splitting a word between one line and the next. The --wordwrap argument splits lines at spaces if possible. --justify After wrapping long lines, attempt to justify the text to produce a smooth right-hand margin. Implies --wordwrap. --reload SEC COMMAND Re-display the file(s) and run COMMAND every SEC seconds. The default is to never re-display the file(s). --shade Add black shading to the font. --outline Add a black outline to the font (making redraws quite a bit slower). --minspace Use minimum linespace even when using shading or outlining. This might result in leftover pixels (dependign on font and logfile con- tent). --noflicker Use slower but flicker-free update. --noinitial Don't display the end of the file(s) initially. -id ID Use the given window ID for output instead of the root window. -i | --interval SECONDS Use the specified sleeping interval between checks instead of the default 2.4 seconds. Fractional values are OK. -V Print version information. --frame Draw a frame around the selected area. This is useful when trying to find the perfect geometry. EXAMPLE
root-tail -g 800x250+100+50 -font 10x20 /var/log/messages,green -font 12x24 /var/log/secure,red,'ALERT' BUGS
Some desktop environments open a virtual root window and make it difficult to share it. If you cannot see anything after starting root- tail, try to find a setting "allow programs on desktop" or similar, or manually specify a window id. Should you happen to find any bugs please fix them and send me a diff. NOTE: This program was modified by Marc Lehmann <pcg@goof.com>, who couldn't reach the original author. Please direct bug-reports etc. to pcg@goof.com. http://root-tail.plan9.de/ 4.2 Berkeley Distribution 2004-03-27 ROOTTAIL(1)
All times are GMT -4. The time now is 06:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy