Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how do I insert argument into TOP of file using vi? Post 302129488 by rprules on Tuesday 31st of July 2007 07:44:54 AM
Old 07-31-2007
the only thing i understood from that was wc.

i just need to know how to put the text like 2 lines in or if there is an automatic way - i.e. a command that can enter text at around 50% of wc.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED- Insert text at top of file

Does anyone know how to insert text at the top and bottom of a file using sed? (12 Replies)
Discussion started by: MBGPS
12 Replies

2. Shell Programming and Scripting

insert text into top of file

how would you insert text into a existing file using aguments first arguments being the line of text and the second argument being file name (1 Reply)
Discussion started by: jimbob
1 Replies

3. UNIX for Dummies Questions & Answers

Inserting argument into top of a file

Hi, I am new to Unix, and I am trying to append a line of argument into a current file. I need this line to be inserted into the very top of the file. Does anyone know how this is done? For example, I am trying: echo "insert to top" >> filename. This inserts the line at the bottom of the... (7 Replies)
Discussion started by: Dev06
7 Replies

4. Shell Programming and Scripting

best way to insert a line at the top of a file?

say I want to insert "this is a test" as the first line into file A, besides echo "this is a test" > /tmp/tmpfile cat /tmp/tmpfile fileA >> /tmp/result, is there any simple way I can do it? thanks (7 Replies)
Discussion started by: fedora
7 Replies

5. Shell Programming and Scripting

get positive number n as argument script must calculate the factorial of its argument

Can someone please help me with this SHELL script? I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1. Here is a start but I have no clue how to... (3 Replies)
Discussion started by: I-1
3 Replies

6. Shell Programming and Scripting

Cannot compare argument in if statement in csh/grep command if argument starts with “-“

If ($argv == “-debug”) then Echo “in loop” Endif But this is not working. If I modify this code and remove “-“, then it works. Similarly I am getting problem using grep command also Grep “-debug” Filename Can someone please help me on how to resolve these... (1 Reply)
Discussion started by: sarbjit
1 Replies

7. UNIX for Advanced & Expert Users

Insert string in binary file at top

How can i append a EBCDIC string of 100 bytes to 0th position of a binary file in UNIX. (4 Replies)
Discussion started by: param_it
4 Replies

8. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

9. UNIX for Advanced & Expert Users

Error:--test: argument expected--Even though i give an argument.

Hi All, I am running the script VBoxManage list vms |sed 's/"//g' | cut -d " " -f1 > har1out.mytxt result=`cat har1out.mytxt | grep $1' echo $result echo $1 { if then echo pass else echo fail fi (2 Replies)
Discussion started by: harsha85
2 Replies

10. Shell Programming and Scripting

Insert date/time header at top of file

I'm trying to take mrt output and put it at the top of a file along with the date and time. I was able to do it at the bottom of the file with the following printf "********** $(date) **********\n\n" >> $OUTPUT_PATH/$HOSTNAME mtr -r -w -c 10 $HOSTADDRESS >> $OUTPUT_PATH/$HOSTNAME printf... (2 Replies)
Discussion started by: kramer65
2 Replies
diffmk(1)						      General Commands Manual							 diffmk(1)

NAME
diffmk - Marks differences between files SYNOPSIS
diffmk [-b] [-ab'mark'] [-ae'mark'] [-cb'mark'] [-ce'mark'] [-db'mark'] [-de'mark'] file1 file2 The diffmk command compares two versions of a file and creates a new file that marks the differences. OPTIONS
Uses mark to mark where added lines begin. Uses mark to mark where added lines end. Ignores differences that are only changes in tabs or spaces on a line. Uses mark to mark where changed lines begin. Uses mark to mark where changed lines end. Uses mark to mark where deleted lines begin. Uses mark to mark where deleted lines end. DESCRIPTION
The file1 and file2 variables are the old and new versions of the file, respectively. The diffmk command compares them and writes a new version to standard output, which can be redirected to a file. This output contains the lines of file2 marked with nroff change mark requests (.mc), or with the marks you specify with the -ab, -ae, -cb, -ce, -db, and -de options. When output containing requests is formatted with nroff, changed or inserted lines are marked by a | (vertical bar) at the right margin of each line. An * (asterisk) indicates that a line was deleted. If the DIFFMARK environment variable is defined, it names a command string that diffmk uses to compare the files. (Normally, diffmk uses the diff command.) For example, you might set DIFFMARK to diff -h in order to better handle extremely large files. EXAMPLES
To mark the differences between two versions of a text file, enter: diffmk -ab'>I:' -ae'<I' -cb'>C' -ce'<C' -db'>D' -de'<D' chap1.old chap1 >chap1.diffs This causes diffmk to create a copy of chap1 called chap1.diffs, showing differences between chap1.old and chap1. Additions of one or more lines are marked with >I and <I, changed lines are marked with >C and <C, and deletions are marked with >D and <D. To mark differences with nroff requests, enter: diffmk chap1.old chap1 > chap1.nroff This produces a copy of chap1 called chap1.nroff containing nroff change mark requests to identify text that was added to, changed, or deleted from chap1.old. To use different nroff marking requests and ignore changes in white space, enter: diffmk -b -cb'.mc %' chap1.old chap1 > chap1.nroff This imbeds commands that mark changes with % (percent sign), additions with | (the default, because no -a option is specified), and deletions with * (the default). It does not mark changes that only involve a different number of spaces or tabs between words (-b). SEE ALSO
Commands: diff(1), nroff(1) diffmk(1)
All times are GMT -4. The time now is 06:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy