Script to select the rows from the feed file based on the input value provided
Hi Folks,
I have the below feed file named abc1.txt in which you can see there is a title and below is the respective values in the rows and it is completely pipe delimited file ,.
now this feed files is been generated regularly by a process and is being kept at unix box at the following location /usr/cft/str so finally the file is at /usr/cft/str/abc1.txt
now from the right side you can see there is a column named ADM_ID , so can you please advise the script which will take ADM_ID as input from me
for example as per above feed file i can pass the ADM_ID as 861 from me , then that script will select all the rows where ADM_ID value is 861 (as rite now in the above sample there are
total 2 rows where ADM_ID value is 861) and then will put these two rows in the separate text file , so in this process a new file is created at the same location (/usr/cft/str)
and the name of the file is ADM_861 and this file will contain all the rows where ADM_ID value is 861 please advise the script for this, Thanks in advance
so finally the new file created by script at the same location named ADM_861 Wwill look like this..
Folks please advise can I save this command in a script file lets say named filesplitter.sh and set it's permission to 777 please advise so that last I will execute the file like sh filesplitter 861
Anything you can run at the command line (well, almost anything!) you can put in a script.
But I wouldn't set it's permissions to 777. With that you're inviting anyone to change the script. 755 is good enough, assuming you want anyone to be able to view or run the script.
When I use the following grep command with options -F and -f, its just displaying the text related to only the last pattern.
Command: $ grep -f pattern_file.txt input_file.txt
Output: doc-C2-16354
Even the following command yields the same output:
Command: $ grep -Ff pattern_file.txt... (6 Replies)
Hi All,
I have a menu driven scripts. As you know while running the script we have to input the option such as 1,2, and 3 to execute function accordingly. but after selecting the input we have to press Enter.
My requirement is to execute function as soon as we press the option.
Is there... (5 Replies)
Hi All,
I need to remove all files except the most update data based on date on filename
Input
data_AIDS_20150312.txt
data_AIDS_20150311.txt
data_AIDS_20150411.txt
data_AIDS_20140312.txt
the most updated data is data_AIDS_20150411.txt, so I'll remove other files. My expected output... (3 Replies)
Hi Sir,
I am just learning bash scripting and I came across a challenge.
I need to input F11 to a script among many text inputs.
For all the text inputs i did following.
# sh test.sh < input.txt
where input.txt contains all the text inputs in new lines.
This worked fine until i... (1 Reply)
Hi, I have the following file:
LOG:015608::ERR:2310:map_spsrec:Invalid parameter
LOG:015608::ERR:2471:map_dgdrec:Invalid parameter
LOG:015608::ERR:2487:map_nnmrec:Invalid number
LOG:015608::ERR:2310:map_nmrec:Invalid number
LOG:015608::ERR:2438:map_nmrec:Invalid number
As a delimiter I... (2 Replies)
I have 2 files,
file01= 7 columns, row unknown (but few)
file02= 7 columns, row unknown (but many)
now I want to create an output with the first field that is shared in both of them and then subtract the results from the rest of the fields and print there
e.g.
file 01
James|0|50|25|10|50|30... (1 Reply)
Sorry Guys for not being able to explain in one of my earlier post.
I am now putting my requirement with the input file and desired output file.
In the below input file -
Transaction code is at position 31:40.
Business code is from position 318:321
TSCM00000005837 ... (7 Replies)
I need to delete rows based on the number of lines in a different file, I have a piece of code with me working but when I merge with my C application, it doesnt work.
sed '1,'\"`wc -l < /tmp/fileyyyy`\"'d' /tmp/fileA > /tmp/filexxxx
Can anyone give me an alternate solution for the above (2 Replies)
I have a file containing a list of references and I want to run a script that will make the same action for each reference.
The input file changes every hour, it's why I want to use a script that can read in a file, record by record, and run a specific action for the reference readed.
Thanks... (1 Reply)