10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Say you want to clear your .bash_history except for the first 25 lines. Try:
sed -i -e 26,500d .bash_historyI have a some frequently-used routines parked in the first few lines, and they kept getting overwritten by more recent commands. (2 Replies)
Discussion started by: Xubuntu56
2 Replies
2. Shell Programming and Scripting
My source file is structured with two words on each line
word1 word2
word1 word2
I am using sed and awk to grab groups of specific lines
line=`awk 'NR>=4 && NR<=7' file1`; echo $line
line=` sed -n '1,5'p file1`; echo $line
The resulting output is
word1 word2 word1 word2 word1... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies
3. Shell Programming and Scripting
Hello,
I was wondering how is it possible if I use this command:
awk 'NR >= 998 && NR <= 1000' file.txtTo exit after parsing the 1000th line ( last line targeted) ???
I observed that when executing this command for a large file, if the range of lines is at the beginning of the file it is... (2 Replies)
Discussion started by: black_fender
2 Replies
4. UNIX for Dummies Questions & Answers
I have a directory question where I ask the user which entry he wants to delete...
echo "Which entry?"
read entry
sed '/^'$entry'/d' file
This code does in fact delete that particular entry...
HOWEVER, when I go to inquire about that same entry, it still populates like it was never... (4 Replies)
Discussion started by: itech4814
4 Replies
5. Shell Programming and Scripting
Hi guys!
I'm new to scripting and I need to write a script in awk.
Here is example of file on which I'm working
ATOM 4688 HG1 PRO A 322 18.080 59.680 137.020 1.00 0.00
ATOM 4689 HG2 PRO A 322 18.850 61.220 137.010 1.00 0.00
ATOM 4690 CD ... (18 Replies)
Discussion started by: grincz
18 Replies
6. Shell Programming and Scripting
Hello,
I am obviously quite new to unix and awk. I need to parse certain columns of a file (delimited by spaces), and somehow save the value of this column somewhere, together with the value of the column just after it (by pairs; so something like ).
I'm then supposed to count the times that... (9 Replies)
Discussion started by: acsg
9 Replies
7. Shell Programming and Scripting
Is it possible to save the result of an AWK match to use later in a BASH script.
Thanks,
Jordon (4 Replies)
Discussion started by: jhirshon
4 Replies
8. Shell Programming and Scripting
Hi All,
Is there a way to save a range in variable for later printing?
for example write somthing like this:
awk '
/pattern1/,/pattern2/{f=range}
/pattern3/{print f}
'
I don't know excatly what "range" could be but is there a way to do this? (8 Replies)
Discussion started by: ghoda2_10
8 Replies
9. Shell Programming and Scripting
Hello, I have a file including some lines as follows
person (1):
a
d
t
person (2):
f
h
j
person (3):
z
x
v
.
.
. (8 Replies)
Discussion started by: rpf
8 Replies
10. Shell Programming and Scripting
Hi,
snp.txt
CHR_A SNP_A BP_A_st BP_A_End CHR_B BP_B SNP_B R2 p-SNP_A p-SNP_B
5 rs1988728 74904317 74904318 5 74960646 rs1427924 0.377333 0.000740085 0.013930081
5 ... (12 Replies)
Discussion started by: genehunter
12 Replies