473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Shell script for file content manipulation

1
Hello there, i'm a newbie for linux and need some help with a script. Basically what i need to do is;

Below are links for pdfs to be opened and the links change dynamically as new content gets in

ORIGINAL FILE CONTENT FORMAT
---------------------
test1.pdf?123xyz
test2.pdf?345xyz
test3.pdf?456xyz

FILE CONTENT FORMAT I NEED
--------------------
test1.pdf
test2.pdf
test3.pdf

How can we make this happen by using "sed" command, i tried it but it seems i don't have enough knowledge.
Feb 9 '12 #1
1 2553
rski
700 Expert 512MB
If you just want to cut off strings after .pdf do like like that
Expand|Select|Wrap|Line Numbers
  1. cat you_file_with_links| sed 's/\(.*pdf\)\(.*\)/\1/g' >> new_file_with_links
  2.  
or
Expand|Select|Wrap|Line Numbers
  1. sed -i 's/\(.*pdf\)\(.*\)/\1/g' you_file_with_links
  2.  
first one is much safer because you do not overwrite original file. If you use second solution, make a backup of the file before
Feb 13 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: FPGA05 | last post by:
Hello All, I am developing a small application in which I would need a C++ application to read the output from a shell script. A shell script keeps looking for user inputs and once the user...
10
by: lawrence k | last post by:
I've got a script called makeRss.php. It works fine if I try to open it with my browser. It makes an RSS feed for every page on my site. You can see it working here: ...
4
by: chippy | last post by:
I am finding that when I use the cloneNode method to copy an HTML element that contains a <script> tag, the contents of the <script> tag, (ie. the javascript) are removed. If I do this: var...
1
by: news | last post by:
At the end of a PHP script, I'm sending a file via FTP to a server. I thought it'd be best to use a shell script in order to automate the FTP (logging in, changing to binary, putting the file,...
9
by: sohan | last post by:
Hi, I want to know how to connect and execute a db2 query from inside a UNIX shell script. Details: We have a unix shell script. We need to execute multiple db2 sql queries from this shell...
1
by: shaheda begum | last post by:
Hai, How to call c functions from shell script(.sh file)???I want to call init functions(tasks) which are in .c file from .sh file..Can anyone suggest me the solution for this...........
1
by: looza | last post by:
Hi All, I have a bunch of shell script files that use a common shell script file that contains certain global variables that are declared and initialized or derived by some arithmatic. I have...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
1
by: rasmidas | last post by:
Hi, I have written a shell script, in which I am connecting to the oracle database and doing some manipulation. while I am running the script, its showing me the messages I am displaying in the...
3
by: lakk | last post by:
Having a database created, is it possible to excute queries on this database from a shell script file??
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.