473,385 Members | 1,757 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,385 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 2554
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.