Sponsored Content
Full Discussion: grep only first line
Top Forums UNIX for Dummies Questions & Answers grep only first line Post 302389377 by juliette salexa on Sunday 24th of January 2010 03:43:02 PM
Old 01-24-2010
grep only first line

Hello,

I have a folder with several files, and I want to find which files have the string "test" in the FIRST line. I also don't want it to waste time searching in lines other than the first line because they are gigantic files and I only case about the first file.

grep "test" *.* will give me a list of all files with "test" anywhere in the file,

but I want something that will not search anything other than the first line of each file.

Is this possible ??
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grep or other ways to output line above and/or below searched line

Hi all, Would like to know how I could search for a string 'xyz' but have the output show the line plus the line above and/or below all lines found. eg. search for xyz from file containing: abc 12345 asdf xyz asdfds wwwww kjkjkj ppppp kkkxyz eeee zzzzz and the output to... (2 Replies)
Discussion started by: sammac
2 Replies

2. Shell Programming and Scripting

cat file1 read line-per-line then grep -A 15 lines down in fileb

STEP 1 # Set variable FILE=/tmp/mainfile SEARCHFILE =/tmp/searchfile # THIS IS THE MAIN FILE. cat /tmp/mainfile Interface Ethernet0/0 "outside", is up, line protocol is up Hardware is i82546GB rev03, BW 100 Mbps Full-Duplex(Full-duplex), 100 Mbps(100 Mbps) MAC address... (6 Replies)
Discussion started by: irongeekio
6 Replies

3. Shell Programming and Scripting

Sed or Grep to delete line containing patter plus extra line

I'm new to using sed and grep commands, but have found them extremely useful. However I am having a hard time figuring this one out: Delete every line containing the word CEN and the next line as well. ie. test.txt blue 324 CEN green red blue 324 CEN green red blue to produce:... (2 Replies)
Discussion started by: rocketman88
2 Replies

4. Shell Programming and Scripting

How to grep the line with error where keyword in next line is known.

If a file consists of a thousands of line. There is a error line in the file which exists just before the line with word "Manish". How could I write a script to grep the line with error. Ex:- If I have a UNIX file which contains the following: bash-3.2$ cat unix.txt Unix (officially... (4 Replies)
Discussion started by: manishdivs
4 Replies

5. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

6. Shell Programming and Scripting

How to Grep than scan line below grep pattern

Hello Colleagues, I have a file that looks like below. 6-12731913-12731913 9230760143480 410018547148230 20131002193434+0500 20131002193434+0500 ;20131002T161031000-10.50.241.21-21912131-1419034760, ver: 0 20131009 92220056296730 CC0P abc Core_Context_R1A SMS 6-12726796-12726796... (14 Replies)
Discussion started by: umarsatti
14 Replies

7. UNIX for Dummies Questions & Answers

Piping grep into awk, read the next line using grep

Hi, I have a number of files containing the information below. """"" Fundallinfo 6.3950 14.9715 14.0482 """"" I would like to grep for Fundallinfo and use it to read the next line? I ideally would like to read the three numbers that follow in the next line and... (2 Replies)
Discussion started by: Paul Moghadam
2 Replies

8. UNIX for Dummies Questions & Answers

Grep with special chars line by line

I have a file that includes strings with special characters, eg file1 line: 1 - special 1 line: = 4 line; -3 etc How can I grep the lines of file1 from file2, line by line? I used fgrep and egrep to grep a particular line and worked fine, but when I used: cat file1|while read line;do... (2 Replies)
Discussion started by: FelipeAd
2 Replies

9. Shell Programming and Scripting

Sed/grep: check if line exists, if not add line?

Hello, I'm trying to figure out how to speed up the following as I want to use multiple commands to search thousands of files. is there a way to speed things up? Example I want to search a bunch of files for a specific line, if this line already exists do nothing, if it doesn't exist add it... (4 Replies)
Discussion started by: f77hack
4 Replies

10. Shell Programming and Scripting

Grep -q not works with multiples grep in same line

Hi, I'm trying to make a grep to see if exists occurrences with a sentence like these: grep -qi "message" file0 | grep -i $date | grep -vi "exception" echo $? 1 If I execute without -q modifier I can find occurrences. Someone could help me please? Thanks and sorry for my English! (1 Reply)
Discussion started by: mierdatuti
1 Replies
fadecut(1)						      General Commands Manual							fadecut(1)

NAME
fadecut - Toolset to rip audiostreams, cut, fade in/out and tag the resulting audiofiles SYNOPSIS
fadecut -p <profile> [ OPTIONS ] DESCRIPTION
fadecut is a script to rip audio files from a livestream (using streamripper) and to process them automatically. Beginning and ending fo the audio files will be cut and faded in/out. So logos and advertising of radio stations will be automatically removed. In streaming mode fadecut is ripping audio files using streamripper. The downloaded audio files are cutted using silence detection and then faded in and out. Subsequently, the files are encoded to either ogg or mp3 and tagged with tags (title, artist, genre and comment pro- vided). In file mode fadecut is just processing already ripped audio files. An audio file which has already been processed is detected and will not be processed again. Not desired songs can be stored in a separate directory. This files are not processed anymore too. FOLDERS
fadecut is working with some standard folders. You may change them in your profile or fadecutrc done/ here you put all your songs which were already processed by fadecut and which you want to keep. See also new/ folder. dontlike/ in this folder you may put songs which you don't like. Fadecut is checking this folder before it is processing new files in the working folder. Null size files are ok. error/ whenever an error occurs while fadecut is processing a file, that file is moved to the error folder for later examining. incomplete/ this folder is created by streamripper. All not fully ripped songs are saved here. new/ processed songs are going here. Usually you may rip and process files with fadecut, they are going in to new/ folder, you listen to them and put good songs to the done/ folder. orig/ if you want to keep the original file (which is ripped by streamripper), you may use the -k option. fadecut is putting the ripped files untouched into that folder. OPTIONS
-c Create a new profile <profilename> -e Edit an existing profile <profilename> -i optional input <directory> -o optional output <directory> -k optional to keep the untouched original song in the /orig folder -d Debug: -d 0|1|2|3 (level 0 is standard, -d without number is like 1) -h Show this message -p Profile <profilename> -q Quiet -r Stream (and rip), start streamripper -v Verbose VARIABLES
STREAM_URL="http://streamurl" test ENCODING=ogg preferred destination fileformat. (ogg/mp3) GENRE="SwissPop" Processed files will get the above genre. COMMENT="Radio Swiss Pop" Processed files will get the above comment. TRIM_BEGIN=0 cut <n> seconds off the file in the beginning. TRIM_END=0 cut <n> seconds off the file at the end. FADE_IN=1 Fade in for <n> seconds. FADE_OUT=4 Fade out for <n> seconds. EXAMPLES
Create a new ripping profile fadecut -c test Edit/update profile test fadecut -e test Rip, cut and fade in-/out with profile test fadecut -p test -r Only cut and fade in-/out without ripping from livestream fadecut -p test SEE ALSO
id3v2(1), oggenc(1), sox(1), streamripper(1), lame(1) FILES
~/.fadecut/fadecutrc The main fadecut configuration file, executed with every start of fadecut ~/.fadecut/statslog.csv The statistics file ~/.fadecut/profiles The folder where all profiles are located RESOURCES
fadecut git website https://github.com/micressor/fadecut 0.1.0 fadecut(1)
All times are GMT -4. The time now is 11:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy