General :: View File Ignoring Set Of Lines?

Jun 21, 2010

I'm having a file with repeated particular text lines. So I need to view the file content ignoring these lines. Is there anyway I can achieve this using VI

View 2 Replies


ADVERTISEMENT

General :: View A Particular Ten Lines In A Large File Where Can't Open The File In Vi

May 12, 2010

I am using RHEL 5.I have a very large test file which cannot be opened in vi.The content of the file has some 8000 lines.I need to view ten lines between 5680 to 5690.How can i view these particular lines in a large file.what is command and option i need to use.

View 1 Replies View Related

General :: Replace Several Lines In A File With Other Lines In Another File?

Oct 26, 2009

I have this massive table file with some data in it and I want to replace some lines that are wrong with the correct ones that are in another table file of the same format. The wrong lines are not all together in a block but randomly distributed so I need to make a loop checking if the line is in the other file and if it is, replace it. I want to try and do it with sed or awk but I don't really know how to....

View 12 Replies View Related

General :: Copy File Recursively Ignoring Destination Directory Structure?

Jul 8, 2011

I have the following content on the source directory:

source/foo.txt
source/bar/another_file.txt
source/bar2/and_another.txt

I want copy those files to a destination directory which, after copy, shall look like this:

destination/foo.txt
destination/another_file.txt
destination/and_another.txt

How can I do this? It seems that "cp" lacks such an option

View 1 Replies View Related

General :: Script To Insert Number Of Lines In A File To The Start Of The File?

Sep 17, 2009

I'm looking for a way to insert the number of lines in a file to the start of the aformentioned file. This should be simple but as I am not used to scripts in Linux, I am finding it tough going. I can find the number of lines in a file easily enough via

filesize=$(awk 'END {print NR}' $1)

but as for inserting this into the first line, i'm failing to do so. I've tried some of the other approaches on these forums but none so far have been able to do so.

I've tried:

sed '1i$filesize' $1

but sed i requires a string, not a variable so no go I've also tried:

mv "$1" "${1}.bak" 2>/dev/null || touch "${1}.bak"
cat $filesize "${1}.bak" >"$1"

but again with no luck as cat seems to need an input stream Just to recap, i want to insert a line at the start of a given file that holds the number of lines the original file has.

ie the file:

a
b
c
d
e

should become:

5
a
b
c

[code].....

View 3 Replies View Related

General :: File Privileges - Check And Set Who Can View Or Open A Given Folder Or File?

Jul 30, 2010

How can I check and set who can view or open a given folder or file?

View 1 Replies View Related

General :: Removing Lines From A File That Are In Another File?

Jan 6, 2011

I have a large text file containing over 180k lines and another text file containing about 1k. I would like to remove lines in the 180k-line file that exist in the 1k-line file.

View 5 Replies View Related

General :: Add Characters To Several Lines In A File?

Apr 17, 2009

I would like to modify the content of a text file in Linux, in the following way:=> the file has several of these lines:./run_pest3 ./g134366.04080_0.062 x 2_d043 1 0.43 results_EC=> I want to modify all lines to be:./run_pest3 ./g134366.04080_0.062 x 2_d043 1 0.43 results_EC0.062i.e., the last number of $2 should be "attached" to the end of $7, for each line.

View 5 Replies View Related

General :: Extract Lines From File Using AWK ?

Aug 5, 2010

I have a file similar to this:

I need to print the last line for each user into a file. The resulting file should look like this:

Is there a way that AWK can match lines from $1 and then print the last line into a file?

View 7 Replies View Related

General :: Adding Lines Of A File Together?

Feb 22, 2010

I'm trying to output two certain fields of a very large text file to 2 very small text files. Then take those files and add all the lines together to come up with a total from each file (two totals).

Here's what I've got:

Code:

#!/bin/bash
echo "0" > /media/in.txt
echo "0" > /media/out.txt

[code]....

Breakdown: Put 0 in a text file to be drawn by respective while loops for math later

Output last 60 integers to a file for total A (new integer every minute)
Output last 60 integers to a file for total B (new integer every minute)

The two while loops are supposed to be adding the lines together. The echo commands at the end are for testing purposes, just to see the output. However, when I run this, I get the output of

Code:

0 0

Which is obviously not what it's supposed to be. Is there a more efficient way to do this or am I missing something in the script that would reset the values to "0"?

View 2 Replies View Related

General :: Delete Last 6 Lines Of File With Sed

Jun 5, 2011

looking to delete the last 6 lines of a file with sed. figured out how to delete the last line..but i want the last six.

View 6 Replies View Related

General :: Add A Line In A File Before The Last Two Lines?

Aug 2, 2010

I need to add a line in a file before the last two lines using a script using standard linux editors like sed but i can't figure it out.

View 2 Replies View Related

Programming :: Reading A Binary File (Ignoring Null Terminator)

Jan 12, 2011

I need to read a binary file using my C++ application. That binary file may contain arbitary characters and it also contains 0 at some places. I need to read the file without considering null terminating character. (i.e. considering 0 as a normal byte and not as the end of the string)Can some one suggest me a method to read the buffer while ignoring the null terminated character.

View 4 Replies View Related

General :: View Chm File In Red Hat?

Jan 27, 2010

i have a doubt regarding chm file.how to view chm file in redhat linux EL5

View 4 Replies View Related

General :: Conditionally Deleting Lines From File

Mar 10, 2011

I am facing some problem regarding deletion of a line from a text file. The file consists of the lines of type which consists of more than 6 occurrences of : character in it. The line should be deleted completely and the line next to it must be shifted up.

View 1 Replies View Related

General :: Copy Some Lines In A File And Delete These After?

Jul 20, 2010

I have a file that contains 100 ligns, i need to write a script that read 70 lignes and redirect those 70 ligns to another files and these 70ligns have to be erased in the first file

when i write this command
head -70 somefile.txt>test.txt
or

sed -n 70p somefile.txt>test.txt

i have these 70 lines in the text.txt files
but these 70 lines have to be deleted inthe first file somefile.txt

View 1 Replies View Related

General :: Split A File Into Two - The First Being The First Two Lines And The Second The Rest?

Nov 1, 2010

I'd like to split a file into two, where the first file is the first two lines and the second is the remaining lines (third line to EOF).

View 2 Replies View Related

General :: Delete Lines From File By Their's Length

Apr 27, 2010

i've got a file with sorted words - one on each line.How could it be possible to delete thouse lines that have words of length 1 or 2 (1-2 letters). I guess a good way it will be with AWK, n its fuction length(), but getting it, i dont know how to delete those very lines.

View 14 Replies View Related

General :: Grep And Store Two Lines In Other File

Feb 16, 2011

I have following contents

I want to grep "#2" and want the output as

How to using shell script?

View 6 Replies View Related

General :: Remove All Lines In A File Containing Sameword?

Aug 6, 2010

When i want to remove particular lines containing a specific word in from entire document at a time,i am using the following command.

awk '$columnno !~/specificword/' inputfile > outputfile

But here, coulmn no is my problem, because iam having this in different columns. So i need a solution for it.

How to write such removal command without mentioning column no. , ie irrespective of column no, it has to remove all lines having that specific word.

View 10 Replies View Related

General :: Use AWK To Print Out First Few Lines Of A Text File?

Jul 27, 2011

I have a few rather large text files, and I need a way to look at the first three lines of each. Is there a way to do this using awk?

View 3 Replies View Related

Ubuntu :: Get Wget To Download Files From A Server Ignoring Some From A Text File?

Jun 29, 2010

I use the

Code:
wget -r -A <extension> <site>

command to download all files from a certain site. this time i already have some of the files already downloaded and listed in a text file via

Code:
ls > <text file name>

How can i make wget to download from the site i want but ignore the filenames listed in the text file?

View 2 Replies View Related

General :: How To View Chm File In Redhat

Jan 28, 2010

i have a doubt regarding chm file.how to view chm file in redhat linux EL5

View 2 Replies View Related

General :: How To View Image File

Jul 16, 2010

I am working on a linux cluster based on Scientific Linux 5. I have some images in .bmp format. How can i view them from the command line or without downloading to desktop? At present I am connecting from Win7 using Exceed.

View 4 Replies View Related

General :: Only Execute The Rwx And View The File?

Aug 27, 2009

For example, I write the file like in vi or something. I wanna execute but no one read , write and execute but one more thing no one to view the file like encrypt the file.

View 5 Replies View Related

General :: View A File With Its Inode Nno?

Nov 2, 2010

how can we view a file with its inode nno . eg. cat 12456 where 12345 is the inode of a file

View 3 Replies View Related

General :: Grep Multiple Lines From A Text File

Jun 17, 2009

I have a list of words that I want to grep in many files to see which ones have it and which ones dont. in the text file I have all the words listed line by line, ex: list.txt:

check
try this
word1
word2
open space
list ..

I want to grep each line one by one. like I want it to

grep "check" *.log
grep "try this" *.log
grep "word1" *.log .. etc how can I do this?

and maybe write the output to a file.

View 5 Replies View Related

General :: Command To Swap Even And Odd Numbered Lines In A File

May 28, 2010

I'm looking for a command to swap the even/odd numbered lines in a file. Example input file:

Code:

1
2
3
4

[code]...

Example output file:

Code:

2
1
4
3

[code]....

I'm sure there's a way to do it with sed, awk, grep and the like but it's been many years since I've used these commands on a daily basis and I can't seem to figure out the correct syntax.

View 2 Replies View Related

General :: Commands To Remove Particular Few Lines In History File?

Jun 16, 2010

Is there any commands or scripts to remove only selected line in the history file.

View 1 Replies View Related

General :: Delete All Lines In A File Which Consists Of Particular String?

Mar 21, 2011

i am having following lines in a file called test.

subscribe parser for dinesh
extend size for dinesh
subscribe parser for anish
unsubscribe parser for dinesh
extend size for arvind

I want to delete all lines which contains the string "dinesh". Is it possible.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved