A double-hulled structure is a typical hazardous environment found in the shipbuilding areas. Therefore many efforts have been made for automation, especially for the welding tasks. However, constraints such as size and weight limits of the robot and the randomness of the tasks have made automation very difficult. Therefore simple and robust algorithms are preferable in this typical field. In this paper a seam tracking algorithm for weaving weld path planning using a laser displacement sensor is developed. It is designed to enable portable robots detect the seam of very irregular single butt welding profiles. The algorithm consists of four steps; Scan, Filtering, Generation of reference points, Path planning. In the scan process depth data of a cross section of the profile is obtained. Next, Gaussian filter is used to remove noise from the raw data. A differential characteristic point detection algorithm is applied to the filtered data to detect the reference points which represent the shape and location of the gap of the profile to be welded. Finally path planning for single-V butt multi-pass welding is done based on these reference points. The algorithm is validated through welding experiments.