10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I am trying to print searched multiple keywords in multiple files.
It is almost okay with the code but the code puts filename in front of each line.
How may I get rid of it?
-grep -A1 'word1' *.txt | grep -A1 'word2' | grep -A1 'word3'
I expect:
Real outcome:
How may I... (3 Replies)
Discussion started by: baris35
3 Replies
2. Shell Programming and Scripting
I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix.
I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice.
Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
3. Programming
Hello,
A python beginner question on passing filename thru argument. My code is:
#!/usr/bin/python
import sys, getopt
import os
def main(argv):
try:
opts, args = getopt.getopt(sys.argv,"hi:o:ce", )
except getopt.GetoptError:
usage()
print("Usage: %s... (6 Replies)
Discussion started by: yifangt
6 Replies
4. UNIX for Dummies Questions & Answers
Dear unix forum,
could I output a list of five books with their file name titles into one file?
In order o output all the contents of all the files with their file names there was: find . -type f | while read x; echo -e "\n$x";cat "$x";done > бетховен.txt
In spite of them being successively... (5 Replies)
Discussion started by: Xcislav
5 Replies
5. Shell Programming and Scripting
First I apologize for my ignorance as I am very new to the world of UNIX but love it and have a huge desire to learn it.
A question I have is if a Korn script utilizes/relies on an argument to run, can you add these into a file and pipe them to the script without changing anything inside the... (2 Replies)
Discussion started by: djzah
2 Replies
6. Shell Programming and Scripting
Hi all
could you help me how to give pids in a file as an argument to renice command.
Thanks in Advance.. :)
Pradeep (4 Replies)
Discussion started by: nanz143
4 Replies
7. Shell Programming and Scripting
Issue: I am able to split source file in multiple files of 10 rows each but unable to get the required outputfile name. please advise.
Details:
input = A.txt having 44 rows
required output = A_001.txt , A_002.txt and so on. Can below awk be modified to give required result
current... (19 Replies)
Discussion started by: santosh2k2
19 Replies
8. Shell Programming and Scripting
Hello everyone,
My requirement is that within a script I need to construct the command line exactly that it was invoked with. For example :
sh a.sh arg1 arg2 arg3 < input.txt > output.txt
Now within a.sh, I construct a file which has these contents "
sh a.sh arg1 arg2 arg3 < input.txt >... (8 Replies)
Discussion started by: hedonist12
8 Replies
9. Shell Programming and Scripting
Hi,
I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format.
Example:
File.txt
AP|{SSHA}VEEg42CNCghUnGhCVg==
APVG3|{SSHA}XK|"password"
AP3|{SSHA}XK|"This is test"
....
etc
---------
test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies
10. UNIX for Dummies Questions & Answers
How can I use the value of an argument as a filename? Example:
The argument for a process is 999. I would like the output of the process to be placed in a file called 999. I have tried using $$1, but that only assigns a unigue number.
thanks
JP (1 Reply)
Discussion started by: jpprial
1 Replies