01-16-2008
help with grep command or other useful command
Hi
I'm new for this forum and actually, I like this forum for the number of experts members that in the forum.
First, How do I use grep command to grep the contents of more than one file(with any extension!) to be saved in one single file?
For example, I have tried this command grep, but it include the file name too..!! Which i don't want to be included?
The command grep I used:
grep "[0-9]" *.PUN > allpun.out
file1 0001091Y.PUN
file2 0001291X.PUN
file3 0001302T.PUN
...
...
fileN *******.PUN
Output file:
0001091Y.PUN:960109 914 4.54 25- 9.21 40-50.34 14.83 2.81 12 335116.5 0.26 6.8 81.7 D1
0001291X.PUN:940129 559 37.02 24-28.93 39-51.79 0.86 1.99 17 151 9.0 0.07 0.2 0.4 B1
0001302T.PUN:940130 1047 38.93 24-53.89 40-44.31 9.52 2.89 20 321 93.9 0.17 1.6 28.7 D1
0001311V.PUN:940131 843 37.78 24-53.54 40-46.08 5.19 2.88 17 322 96.4 0.21 15.9 49.9 D1
But, I don't want the file name to be included in the output file?
(the file name start at the beginning of each line and followed by a colon ':', then the contents of each file).
How do I do that?
Second, how do I grep only, let's say, a range of Latitude and a range of Longitude from the final output file? (Above)
Then, I want to convert the Lat and Long columns to decimals numbers? without the '-' sign?
For your information, the header of this data files are:
DATE ORIGIN LAT N LONG E DEPTH MAG NO GAP DMIN RMS ERH ERZ QM
But, this header not included for all files?
Looking for any help or point!
And I appreciate your help in advance
amm
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
how to search all occurance of keyword in current directory files and sub folder's files also using grep command.
thanks (2 Replies)
Discussion started by: avadhani
2 Replies
2. UNIX for Advanced & Expert Users
I am doing "ps -f" to see my process.
but I get lines that one of it represents the ps command itself.
I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself :
I would like to exclude
# ps -f
UID PID PPID C STIME TTY TIME CMD... (2 Replies)
Discussion started by: yamsin789
2 Replies
3. Shell Programming and Scripting
Hi,
Can anybody explain me about the below mentioned code.
grep "^" $FILENAME | cut -c 1-8,84- | awk '{ if (!($2+$3)) printf $1 "," }' >$TEMP_FILENAME
Thanks in advance. (3 Replies)
Discussion started by: Kattoor
3 Replies
4. Shell Programming and Scripting
i want to search in the current directory all the files that contain one word for example "hello"
i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies
5. Shell Programming and Scripting
Hi,
I Want to grep the 500th character of a line in a file. please help on this.
Thanks in advance (7 Replies)
Discussion started by: raghulshekar
7 Replies
6. UNIX for Dummies Questions & Answers
I need to find the word "who" in a file but only that word. For instance I don't want it to find the word "whoever." Any suggestions? (2 Replies)
Discussion started by: brooksie91
2 Replies
7. Shell Programming and Scripting
Hi, im taking an entry Unix class, and as part of my lab assignment I have to copy all files in the /home/david/lab3 directory that have the file extension .save to your lab3/temp directory. I'm having trouble getting the grep to do anything worth while
I've been trying to do:
cp... (6 Replies)
Discussion started by: Critical jeff
6 Replies
8. Shell Programming and Scripting
i have a file which lists the following
T2323
T3445
T67666,T6534,T4546
T7878
i need to extract the numeric part only(ie,without T).
i tried this script
awk '{print substr($0,2,length($0))}' pmt2.txtOutput
2323
3445
67666,T6534,T4546as u can see the numbers coming after "," remains the... (2 Replies)
Discussion started by: born
2 Replies
9. Shell Programming and Scripting
i have the following lines
T2345
T3435 - bugfixed and running
T5654 fixed and committed
T34541:- fixed and committed
i need to extract only the T part (eg:T2345) ,ie i dont want any special characters after it.
i have been trying with grep and egrep but with no luck.
pls help (11 Replies)
Discussion started by: born
11 Replies
10. Shell Programming and Scripting
Hello,
I am running below command as root user
#nodetool cfstats tests | grep "Memtable switch count"
Memtable switch count: 12
Where as when I try to run same command as another user it gives different result.
#su -l zabbix -s /bin/bash -c "nodetool cfstats tests | grep "Memtable switch... (10 Replies)
Discussion started by: Pushpraj
10 Replies
LEARN ABOUT CENTOS
grub-render-label
GRUB-RENDER-LABEL(1) User Commands GRUB-RENDER-LABEL(1)
NAME
grub-render-label - generate a .disk_label for Apple Macs.
SYNOPSIS
grub-render-label [OPTION...] [OPTIONS]
DESCRIPTION
Render Apple .disk_label.
-b, --bgcolor=COLOR
use COLOR for background
-c, --color=COLOR
use COLOR for text
-f, --font=FILE
use FILE as font (PF2).
-i, --input=FILE
read text from FILE.
-o, --output=FILE
set output filename. Default is STDOUT
-t, --text=STRING
set the label to render
-v, --verbose
print verbose messages.
-?, --help
give this help list
--usage
give a short usage message
-V, --version
print program version
Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options.
REPORTING BUGS
Report bugs to <bug-grub@gnu.org>.
SEE ALSO
The full documentation for grub-render-label is maintained as a Texinfo manual. If the info and grub-render-label programs are properly
installed at your site, the command
info grub-render-label
should give you access to the complete manual.
grub-render-label (GRUB) 2.02-2ubuntu8.3 July 2018 GRUB-RENDER-LABEL(1)