10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field.
The source file is pipe delimited and looks something like
1|net|ABC Letr1|1530|||
1|net|EXP_1040 ABC|1121|||
1|net|EXP_TG1224|1122|||
1|net|R_North|1123|||... (5 Replies)
Discussion started by: Mudshark
5 Replies
2. Shell Programming and Scripting
Hey All,
I want want to print a string N times the number N before it.
Like i have "20 hello".
so i want to print
hello
hello
hello
.
.
.
.
. 20 times..
Please help me.. I am not able o figure out.. how to do the same? (8 Replies)
Discussion started by: jaituteja
8 Replies
3. Shell Programming and Scripting
I have kind of a strange one here. I have a file of consecutive /24 ip blocks. If there are 8 consecutive ip blocks which represent a /20 then I need to print the first line. I played around and did not get the results I need, especially when considering that the highest $3 will be is 255 and then... (6 Replies)
Discussion started by: numele
6 Replies
4. Programming
Hello, I am reading the K & R C book, and trying to understand more about putchar()/getchar() by practice. Similar to the exercise 1-12, I want try to parse each line by character. Although there are many site about the exercise, but I could find similar case of mine, which is similar to fold... (11 Replies)
Discussion started by: yifangt
11 Replies
5. Shell Programming and Scripting
Hi,
I had another question. I was wondering if there was a way to tab a line a variable number of times in tcsh. To go into details, I want to tab a line by how deep a file is in its path.
So here is an example code:
set filea=/blah1/blah2/blah3
set fileb=/blah1/blah2/blah3/blah4
set... (4 Replies)
Discussion started by: chu816
4 Replies
6. Shell Programming and Scripting
Hi All,
I wanted to know if there is a shell command to print a word n number of times
The Input File is :
Cat 4
Bat 3
Zall 1
Kite 2
Output File required is :
Cat
Cat
Cat
Cat
Bat
Bat
Bat
Zall
Kite (4 Replies)
Discussion started by: sam_2921
4 Replies
7. Shell Programming and Scripting
Hi Unix gurus
Basically i am searching for the pattern and getting the line numbers of the grepped pattern. I am trying to print the series of lines from 7 lines before the grepped line number to the grepped line number.
I am trying to use the following code. but it is not working.
cat... (3 Replies)
Discussion started by: mohanm
3 Replies
8. Shell Programming and Scripting
I've been looking on the internet, and haven't found anything simple enough to use in my code. All I want to do is count how many times "-" occurs in a string of characters (as a package name). It seems it should be very simple, and shouldn't require more than one line to accomplish.
And this is... (2 Replies)
Discussion started by: Shingoshi
2 Replies
9. UNIX for Dummies Questions & Answers
I am looking for a bash command that counts the number of times a character appears in a file. For example "I am a newbie, trying to learn shell script". Then the command counts the number of e and gives them as 4. Also I want one that counts the number of times a character in a string is replaced.... (2 Replies)
Discussion started by: #moveon
2 Replies
10. Shell Programming and Scripting
How can I print a '-' on the same line within awk, say 50 times, without actually typing '-' 50 times?
Cheers (3 Replies)
Discussion started by: dbrundrett
3 Replies